create_access_preview

AccessAnalyzer.Client.create_access_preview(**kwargs)

Creates an access preview that allows you to preview IAM Access Analyzer findings for your resource before deploying resource permissions.

See also: AWS API Documentation

Request Syntax

response = client.create_access_preview(
    analyzerArn='string',
    configurations={
        'string': {
            'ebsSnapshot': {
                'userIds': [
                    'string',
                ],
                'groups': [
                    'string',
                ],
                'kmsKeyId': 'string'
            },
            'ecrRepository': {
                'repositoryPolicy': 'string'
            },
            'iamRole': {
                'trustPolicy': 'string'
            },
            'efsFileSystem': {
                'fileSystemPolicy': 'string'
            },
            'kmsKey': {
                'keyPolicies': {
                    'string': 'string'
                },
                'grants': [
                    {
                        'operations': [
                            'CreateGrant'|'Decrypt'|'DescribeKey'|'Encrypt'|'GenerateDataKey'|'GenerateDataKeyPair'|'GenerateDataKeyPairWithoutPlaintext'|'GenerateDataKeyWithoutPlaintext'|'GetPublicKey'|'ReEncryptFrom'|'ReEncryptTo'|'RetireGrant'|'Sign'|'Verify',
                        ],
                        'granteePrincipal': 'string',
                        'retiringPrincipal': 'string',
                        'constraints': {
                            'encryptionContextEquals': {
                                'string': 'string'
                            },
                            'encryptionContextSubset': {
                                'string': 'string'
                            }
                        },
                        'issuingAccount': 'string'
                    },
                ]
            },
            'rdsDbClusterSnapshot': {
                'attributes': {
                    'string': {
                        'accountIds': [
                            'string',
                        ]
                    }
                },
                'kmsKeyId': 'string'
            },
            'rdsDbSnapshot': {
                'attributes': {
                    'string': {
                        'accountIds': [
                            'string',
                        ]
                    }
                },
                'kmsKeyId': 'string'
            },
            'secretsManagerSecret': {
                'kmsKeyId': 'string',
                'secretPolicy': 'string'
            },
            's3Bucket': {
                'bucketPolicy': 'string',
                'bucketAclGrants': [
                    {
                        'permission': 'READ'|'WRITE'|'READ_ACP'|'WRITE_ACP'|'FULL_CONTROL',
                        'grantee': {
                            'id': 'string',
                            'uri': 'string'
                        }
                    },
                ],
                'bucketPublicAccessBlock': {
                    'ignorePublicAcls': True|False,
                    'restrictPublicBuckets': True|False
                },
                'accessPoints': {
                    'string': {
                        'accessPointPolicy': 'string',
                        'publicAccessBlock': {
                            'ignorePublicAcls': True|False,
                            'restrictPublicBuckets': True|False
                        },
                        'networkOrigin': {
                            'vpcConfiguration': {
                                'vpcId': 'string'
                            },
                            'internetConfiguration': {}

                        }
                    }
                }
            },
            'snsTopic': {
                'topicPolicy': 'string'
            },
            'sqsQueue': {
                'queuePolicy': 'string'
            }
        }
    },
    clientToken='string'
)
Parameters
  • analyzerArn (string) --

    [REQUIRED]

    The ARN of the account analyzer used to generate the access preview. You can only create an access preview for analyzers with an Account type and Active status.

  • configurations (dict) --

    [REQUIRED]

    Access control configuration for your resource that is used to generate the access preview. The access preview includes findings for external access allowed to the resource with the proposed access control configuration. The configuration must contain exactly one element.

    • (string) --
      • (dict) --

        Access control configuration structures for your resource. You specify the configuration as a type-value pair. You can specify only one type of access control configuration.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: ebsSnapshot, ecrRepository, iamRole, efsFileSystem, kmsKey, rdsDbClusterSnapshot, rdsDbSnapshot, secretsManagerSecret, s3Bucket, snsTopic, sqsQueue.

        • ebsSnapshot (dict) --

          The access control configuration is for an Amazon EBS volume snapshot.

          • userIds (list) --

            The IDs of the Amazon Web Services accounts that have access to the Amazon EBS volume snapshot.

            • If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the userIds , then the access preview uses the existing shared userIds for the snapshot.
            • If the access preview is for a new resource and you do not specify the userIds , then the access preview considers the snapshot without any userIds .
            • To propose deletion of existing shared accountIds , you can specify an empty list for userIds .
            • (string) --
          • groups (list) --

            The groups that have access to the Amazon EBS volume snapshot. If the value all is specified, then the Amazon EBS volume snapshot is public.

            • If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the groups , then the access preview uses the existing shared groups for the snapshot.
            • If the access preview is for a new resource and you do not specify the groups , then the access preview considers the snapshot without any groups .
            • To propose deletion of existing shared groups , you can specify an empty list for groups .
            • (string) --
          • kmsKeyId (string) --

            The KMS key identifier for an encrypted Amazon EBS volume snapshot. The KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.

            • If the configuration is for an existing Amazon EBS volume snapshot and you do not specify the kmsKeyId , or you specify an empty string, then the access preview uses the existing kmsKeyId of the snapshot.
            • If the access preview is for a new resource and you do not specify the kmsKeyId , the access preview considers the snapshot as unencrypted.
        • ecrRepository (dict) --

          The access control configuration is for an Amazon ECR repository.

          • repositoryPolicy (string) --

            The JSON repository policy text to apply to the Amazon ECR repository. For more information, see Private repository policy examples in the Amazon ECR User Guide .

        • iamRole (dict) --

          The access control configuration is for an IAM role.

          • trustPolicy (string) --

            The proposed trust policy for the IAM role.

        • efsFileSystem (dict) --

          The access control configuration is for an Amazon EFS file system.

          • fileSystemPolicy (string) --

            The JSON policy definition to apply to the Amazon EFS file system. For more information on the elements that make up a file system policy, see Amazon EFS Resource-based policies.

        • kmsKey (dict) --

          The access control configuration is for a KMS key.

          • keyPolicies (dict) --

            Resource policy configuration for the KMS key. The only valid value for the name of the key policy is default . For more information, see Default key policy.

            • (string) --
              • (string) --
          • grants (list) --

            A list of proposed grant configurations for the KMS key. If the proposed grant configuration is for an existing key, the access preview uses the proposed list of grant configurations in place of the existing grants. Otherwise, the access preview uses the existing grants for the key.

            • (dict) --

              A proposed grant configuration for a KMS key. For more information, see CreateGrant.

              • operations (list) -- [REQUIRED]

                A list of operations that the grant permits.

                • (string) --
              • granteePrincipal (string) -- [REQUIRED]

                The principal that is given permission to perform the operations that the grant permits.

              • retiringPrincipal (string) --

                The principal that is given permission to retire the grant by using RetireGrant operation.

              • constraints (dict) --

                Use this structure to propose allowing cryptographic operations in the grant only when the operation request includes the specified encryption context.

                • encryptionContextEquals (dict) --

                  A list of key-value pairs that must match the encryption context in the cryptographic operation request. The grant allows the operation only when the encryption context in the request is the same as the encryption context specified in this constraint.

                  • (string) --
                    • (string) --
                • encryptionContextSubset (dict) --

                  A list of key-value pairs that must be included in the encryption context of the cryptographic operation request. The grant allows the cryptographic operation only when the encryption context in the request includes the key-value pairs specified in this constraint, although it can include additional key-value pairs.

                  • (string) --
                    • (string) --
              • issuingAccount (string) -- [REQUIRED]

                The Amazon Web Services account under which the grant was issued. The account is used to propose KMS grants issued by accounts other than the owner of the key.

        • rdsDbClusterSnapshot (dict) --

          The access control configuration is for an Amazon RDS DB cluster snapshot.

          • attributes (dict) --

            The names and values of manual DB cluster snapshot attributes. Manual DB cluster snapshot attributes are used to authorize other Amazon Web Services accounts to restore a manual DB cluster snapshot. The only valid value for AttributeName for the attribute map is restore

            • (string) --
              • (dict) --

                The values for a manual Amazon RDS DB cluster snapshot attribute.

                Note

                This is a Tagged Union structure. Only one of the following top level keys can be set: accountIds.

                • accountIds (list) --

                  The Amazon Web Services account IDs that have access to the manual Amazon RDS DB cluster snapshot. If the value all is specified, then the Amazon RDS DB cluster snapshot is public and can be copied or restored by all Amazon Web Services accounts.

                  • If the configuration is for an existing Amazon RDS DB cluster snapshot and you do not specify the accountIds in RdsDbClusterSnapshotAttributeValue , then the access preview uses the existing shared accountIds for the snapshot.
                  • If the access preview is for a new resource and you do not specify the specify the accountIds in RdsDbClusterSnapshotAttributeValue , then the access preview considers the snapshot without any attributes.
                  • To propose deletion of existing shared accountIds , you can specify an empty list for accountIds in the RdsDbClusterSnapshotAttributeValue .
                  • (string) --
          • kmsKeyId (string) --

            The KMS key identifier for an encrypted Amazon RDS DB cluster snapshot. The KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.

            • If the configuration is for an existing Amazon RDS DB cluster snapshot and you do not specify the kmsKeyId , or you specify an empty string, then the access preview uses the existing kmsKeyId of the snapshot.
            • If the access preview is for a new resource and you do not specify the specify the kmsKeyId , then the access preview considers the snapshot as unencrypted.
        • rdsDbSnapshot (dict) --

          The access control configuration is for an Amazon RDS DB snapshot.

          • attributes (dict) --

            The names and values of manual DB snapshot attributes. Manual DB snapshot attributes are used to authorize other Amazon Web Services accounts to restore a manual DB snapshot. The only valid value for attributeName for the attribute map is restore.

            • (string) --
              • (dict) --

                The name and values of a manual Amazon RDS DB snapshot attribute. Manual DB snapshot attributes are used to authorize other Amazon Web Services accounts to restore a manual DB snapshot.

                Note

                This is a Tagged Union structure. Only one of the following top level keys can be set: accountIds.

                • accountIds (list) --

                  The Amazon Web Services account IDs that have access to the manual Amazon RDS DB snapshot. If the value all is specified, then the Amazon RDS DB snapshot is public and can be copied or restored by all Amazon Web Services accounts.

                  • If the configuration is for an existing Amazon RDS DB snapshot and you do not specify the accountIds in RdsDbSnapshotAttributeValue , then the access preview uses the existing shared accountIds for the snapshot.
                  • If the access preview is for a new resource and you do not specify the specify the accountIds in RdsDbSnapshotAttributeValue , then the access preview considers the snapshot without any attributes.
                  • To propose deletion of an existing shared accountIds , you can specify an empty list for accountIds in the RdsDbSnapshotAttributeValue .
                  • (string) --
          • kmsKeyId (string) --

            The KMS key identifier for an encrypted Amazon RDS DB snapshot. The KMS key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.

            • If the configuration is for an existing Amazon RDS DB snapshot and you do not specify the kmsKeyId , or you specify an empty string, then the access preview uses the existing kmsKeyId of the snapshot.
            • If the access preview is for a new resource and you do not specify the specify the kmsKeyId , then the access preview considers the snapshot as unencrypted.
        • secretsManagerSecret (dict) --

          The access control configuration is for a Secrets Manager secret.

          • kmsKeyId (string) --

            The proposed ARN, key ID, or alias of the KMS key.

          • secretPolicy (string) --

            The proposed resource policy defining who can access or manage the secret.

        • s3Bucket (dict) --

          The access control configuration is for an Amazon S3 Bucket.

          • bucketPolicy (string) --

            The proposed bucket policy for the Amazon S3 bucket.

          • bucketAclGrants (list) --

            The proposed list of ACL grants for the Amazon S3 bucket. You can propose up to 100 ACL grants per bucket. If the proposed grant configuration is for an existing bucket, the access preview uses the proposed list of grant configurations in place of the existing grants. Otherwise, the access preview uses the existing grants for the bucket.

            • (dict) --

              A proposed access control list grant configuration for an Amazon S3 bucket. For more information, see How to Specify an ACL.

              • permission (string) -- [REQUIRED]

                The permissions being granted.

              • grantee (dict) -- [REQUIRED]

                The grantee to whom you’re assigning access rights.

                Note

                This is a Tagged Union structure. Only one of the following top level keys can be set: id, uri.

                • id (string) --

                  The value specified is the canonical user ID of an Amazon Web Services account.

                • uri (string) --

                  Used for granting permissions to a predefined group.

          • bucketPublicAccessBlock (dict) --

            The proposed block public access configuration for the Amazon S3 bucket.

            • ignorePublicAcls (boolean) -- [REQUIRED]

              Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket.

            • restrictPublicBuckets (boolean) -- [REQUIRED]

              Specifies whether Amazon S3 should restrict public bucket policies for this bucket.

          • accessPoints (dict) --

            The configuration of Amazon S3 access points or multi-region access points for the bucket. You can propose up to 10 new access points per bucket.

            • (string) --
              • (dict) --

                The configuration for an Amazon S3 access point or multi-region access point for the bucket. You can propose up to 10 access points or multi-region access points per bucket. If the proposed Amazon S3 access point configuration is for an existing bucket, the access preview uses the proposed access point configuration in place of the existing access points. To propose an access point without a policy, you can provide an empty string as the access point policy. For more information, see Creating access points. For more information about access point policy limits, see Access points restrictions and limitations.

                • accessPointPolicy (string) --

                  The access point or multi-region access point policy.

                • publicAccessBlock (dict) --

                  The proposed S3PublicAccessBlock configuration to apply to this Amazon S3 access point or multi-region access point.

                  • ignorePublicAcls (boolean) -- [REQUIRED]

                    Specifies whether Amazon S3 should ignore public ACLs for this bucket and objects in this bucket.

                  • restrictPublicBuckets (boolean) -- [REQUIRED]

                    Specifies whether Amazon S3 should restrict public bucket policies for this bucket.

                • networkOrigin (dict) --

                  The proposed Internet and VpcConfiguration to apply to this Amazon S3 access point. VpcConfiguration does not apply to multi-region access points. If the access preview is for a new resource and neither is specified, the access preview uses Internet for the network origin. If the access preview is for an existing resource and neither is specified, the access preview uses the exiting network origin.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys can be set: vpcConfiguration, internetConfiguration.

                  • vpcConfiguration (dict) --

                    The proposed virtual private cloud (VPC) configuration for the Amazon S3 access point. VPC configuration does not apply to multi-region access points. For more information, see VpcConfiguration.

                    • vpcId (string) -- [REQUIRED]

                      If this field is specified, this access point will only allow connections from the specified VPC ID.

                  • internetConfiguration (dict) --

                    The configuration for the Amazon S3 access point or multi-region access point with an Internet origin.

        • snsTopic (dict) --

          The access control configuration is for an Amazon SNS topic

        • sqsQueue (dict) --

          The access control configuration is for an Amazon SQS queue.

          • queuePolicy (string) --

            The proposed resource policy for the Amazon SQS queue.

  • clientToken (string) --

    A client token.

    This field is autopopulated if not provided.

Return type

dict

Returns

Response Syntax

{
    'id': 'string'
}

Response Structure

  • (dict) --

    • id (string) --

      The unique ID for the access preview.

Exceptions

  • AccessAnalyzer.Client.exceptions.ResourceNotFoundException
  • AccessAnalyzer.Client.exceptions.ConflictException
  • AccessAnalyzer.Client.exceptions.ValidationException
  • AccessAnalyzer.Client.exceptions.InternalServerException
  • AccessAnalyzer.Client.exceptions.ServiceQuotaExceededException
  • AccessAnalyzer.Client.exceptions.ThrottlingException
  • AccessAnalyzer.Client.exceptions.AccessDeniedException