Skip to content
v2.275.0

CfnBucket L1 construct ​

The AWS::S3::Bucket resource creates an Amazon S3 bucket in the same AWS Region where you create the AWS CloudFormation stack.

To control how AWS CloudFormation handles the bucket when the stack is deleted, you can set a deletion policy for your bucket. You can choose to retain the bucket or to delete the bucket. For more information, see DeletionPolicy Attribute .

You can only delete empty buckets. Deletion fails for buckets that have contents.

Example ​

ts
declare const cfnTemplate: cfn_inc.CfnInclude;
const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket;

const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.AnyPrincipal(),
});
role.addToPolicy(new iam.PolicyStatement({
  actions: ['s3:*'],
  resources: [cfnBucket.attrArn],
}));
python
# cfn_template: cfn_inc.CfnInclude

cfn_bucket = cfn_template.get_resource("Bucket")

role = iam.Role(self, "Role",
    assumed_by=iam.AnyPrincipal()
)
role.add_to_policy(iam.PolicyStatement(
    actions=["s3:*"],
    resources=[cfn_bucket.attr_arn]
))
java
CfnInclude cfnTemplate;

CfnBucket cfnBucket = (CfnBucket)cfnTemplate.getResource("Bucket");

Role role = Role.Builder.create(this, "Role")
        .assumedBy(new AnyPrincipal())
        .build();
role.addToPolicy(PolicyStatement.Builder.create()
        .actions(List.of("s3:*"))
        .resources(List.of(cfnBucket.getAttrArn()))
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
CfnInclude cfnTemplate;

var cfnBucket = (CfnBucket)cfnTemplate.GetResource("Bucket");

var role = new Role(this, "Role", new RoleProps {
    AssumedBy = new AnyPrincipal()
});
role.AddToPolicy(new PolicyStatement(new PolicyStatementProps {
    Actions = new [] { "s3:*" },
    Resources = new [] { cfnBucket.AttrArn }
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var cfnTemplate CfnInclude

cfnBucket := cfnTemplate.GetResource(jsii.String("Bucket")).(CfnBucket)

role := iam.NewRole(this, jsii.String("Role"), &RoleProps{
	AssumedBy: iam.NewAnyPrincipal(),
})
role.AddToPolicy(iam.NewPolicyStatement(&PolicyStatementProps{
	Actions: []*string{
		jsii.String("s3:*"),
	},
	Resources: []*string{
		cfnBucket.attrArn,
	},
}))

Initializer ​

ts
new CfnBucket(scope: Construct, id: string, props?: CfnBucketProps)
python
CfnBucket(scope: Construct, id: str, props: typing.Optional[CfnBucketProps] = None)
java
new CfnBucket(Construct scope, String id, CfnBucketProps props)
csharp
new CfnBucket(Construct scope, string id, CfnBucketProps? props = null)
go
NewCfnBucket(Scope Construct, Id *string, Props CfnBucketProps)

Construct Props ​

abacStatusoptionalstringabac_statusoptionalstrabacStatusoptionalStringAbacStatusoptionalstringAbacStatusoptional*string#
The ABAC status of the general purpose bucket.
notes

When ABAC is enabled for the general purpose bucket, you can use tags to manage access to the general purpose buckets as well as for cost tracking purposes. When ABAC is disabled for the general purpose buckets, you can only use tags for cost tracking purposes. For more information, see Using tags with S3 general purpose buckets .

accelerateConfigurationoptionalIResolvable | CfnBucket.AccelerateConfigurationPropertyaccelerate_configurationoptionaltyping.Union[IResolvable, AccelerateConfigurationProperty]accelerateConfigurationoptionalIResolvableAccelerateConfigurationoptionalIResolvableAccelerateConfigurationoptionalinterface{}#
Configures the transfer acceleration state for an Amazon S3 bucket.

For more information, see Amazon S3 Transfer Acceleration in the Amazon S3 User Guide .

accessControloptionalstringaccess_controloptionalstraccessControloptionalStringAccessControloptionalstringAccessControloptional*string#
> This is a legacy property, and it is not recommended for most use cases.
notes

A majority of modern use cases in Amazon S3 no longer require the use of ACLs, and we recommend that you keep ACLs disabled. For more information, see Controlling object ownership in the Amazon S3 User Guide .

A canned access control list (ACL) that grants predefined permissions to the bucket. For more information about canned ACLs, see Canned ACL in the Amazon S3 User Guide .

S3 buckets are created with ACLs disabled by default. Therefore, unless you explicitly set the AWS::S3::OwnershipControls property to enable ACLs, your resource will fail to deploy with any value other than Private. Use cases requiring ACLs are uncommon.

The majority of access control configurations can be successfully and more easily achieved with bucket policies. For more information, see AWS::S3::BucketPolicy . For examples of common policy configurations, including S3 Server Access Logs buckets and more, see Bucket policy examples in the Amazon S3 User Guide .

analyticsConfigurationsoptionalIResolvable | IResolvable | CfnBucket.AnalyticsConfigurationProperty[]analytics_configurationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, AnalyticsConfigurationProperty]]]analyticsConfigurationsoptionalIResolvableAnalyticsConfigurationsoptionalIResolvableAnalyticsConfigurationsoptionalinterface{}#
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.
bucketEncryptionoptionalIResolvable | CfnBucket.BucketEncryptionPropertybucket_encryptionoptionaltyping.Union[IResolvable, BucketEncryptionProperty]bucketEncryptionoptionalIResolvableBucketEncryptionoptionalIResolvableBucketEncryptionoptionalinterface{}#
Specifies default encryption for a bucket using server-side encryption with Amazon S3-managed keys (SSE-S3), AWS KMS-managed keys (SSE-KMS), or dual-layer server-side encryption with KMS-managed keys (DSSE-KMS).

For information about the Amazon S3 default encryption feature, see Amazon S3 Default Encryption for S3 Buckets in the Amazon S3 User Guide .

bucketNameoptionalstringbucket_nameoptionalstrbucketNameoptionalStringBucketNameoptionalstringBucketNameoptional*string#
A name for the bucket.
notes

If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID for the bucket name. The bucket name must contain only lowercase letters, numbers, periods (.), and dashes (-) and must follow Amazon S3 bucket restrictions and limitations . For more information, see Rules for naming Amazon S3 buckets in the Amazon S3 User Guide .

If you specify a name, you can't perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you need to replace the resource, specify a new name.

bucketNamePrefixoptionalstringbucket_name_prefixoptionalstrbucketNamePrefixoptionalStringBucketNamePrefixoptionalstringBucketNamePrefixoptional*string#
bucketNamespaceoptionalstringbucket_namespaceoptionalstrbucketNamespaceoptionalStringBucketNamespaceoptionalstringBucketNamespaceoptional*string#
corsConfigurationoptionalIResolvable | CfnBucket.CorsConfigurationPropertycors_configurationoptionaltyping.Union[IResolvable, CorsConfigurationProperty]corsConfigurationoptionalIResolvableCorsConfigurationoptionalIResolvableCorsConfigurationoptionalinterface{}#
Describes the cross-origin access configuration for objects in an Amazon S3 bucket.

For more information, see Enabling Cross-Origin Resource Sharing in the Amazon S3 User Guide .

intelligentTieringConfigurationsoptionalIResolvable | IResolvable | CfnBucket.IntelligentTieringConfigurationProperty[]intelligent_tiering_configurationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, IntelligentTieringConfigurationProperty]]]intelligentTieringConfigurationsoptionalIResolvableIntelligentTieringConfigurationsoptionalIResolvableIntelligentTieringConfigurationsoptionalinterface{}#
Defines how Amazon S3 handles Intelligent-Tiering storage.
inventoryConfigurationsoptionalIResolvable | IResolvable | CfnBucket.InventoryConfigurationProperty[]inventory_configurationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, InventoryConfigurationProperty]]]inventoryConfigurationsoptionalIResolvableInventoryConfigurationsoptionalIResolvableInventoryConfigurationsoptionalinterface{}#
Specifies the S3 Inventory configuration for an Amazon S3 bucket.

For more information, see GET Bucket inventory in the Amazon S3 API Reference .

lifecycleConfigurationoptionalIResolvable | CfnBucket.LifecycleConfigurationPropertylifecycle_configurationoptionaltyping.Union[IResolvable, LifecycleConfigurationProperty]lifecycleConfigurationoptionalIResolvableLifecycleConfigurationoptionalIResolvableLifecycleConfigurationoptionalinterface{}#
Specifies the lifecycle configuration for objects in an Amazon S3 bucket.

For more information, see Object Lifecycle Management in the Amazon S3 User Guide .

loggingConfigurationoptionalIResolvable | CfnBucket.LoggingConfigurationPropertylogging_configurationoptionaltyping.Union[IResolvable, LoggingConfigurationProperty]loggingConfigurationoptionalIResolvableLoggingConfigurationoptionalIResolvableLoggingConfigurationoptionalinterface{}#
Settings that define where logs are stored.
metadataConfigurationoptionalIResolvable | CfnBucket.MetadataConfigurationPropertymetadata_configurationoptionaltyping.Union[IResolvable, MetadataConfigurationProperty]metadataConfigurationoptionalIResolvableMetadataConfigurationoptionalIResolvableMetadataConfigurationoptionalinterface{}#
The S3 Metadata configuration for a general purpose bucket.
metadataTableConfigurationoptionalIResolvable | CfnBucket.MetadataTableConfigurationPropertymetadata_table_configurationoptionaltyping.Union[IResolvable, MetadataTableConfigurationProperty]metadataTableConfigurationoptionalIResolvableMetadataTableConfigurationoptionalIResolvableMetadataTableConfigurationoptionalinterface{}#
The metadata table configuration of an Amazon S3 general purpose bucket.
metricsConfigurationsoptionalIResolvable | IResolvable | CfnBucket.MetricsConfigurationProperty[]metrics_configurationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricsConfigurationProperty]]]metricsConfigurationsoptionalIResolvableMetricsConfigurationsoptionalIResolvableMetricsConfigurationsoptionalinterface{}#
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.
notes

If you're updating an existing metrics configuration, note that this is a full replacement of the existing metrics configuration. If you don't include the elements you want to keep, they are erased. For more information, see PutBucketMetricsConfiguration .

notificationConfigurationoptionalIResolvable | CfnBucket.NotificationConfigurationPropertynotification_configurationoptionaltyping.Union[IResolvable, NotificationConfigurationProperty]notificationConfigurationoptionalIResolvableNotificationConfigurationoptionalIResolvableNotificationConfigurationoptionalinterface{}#
Configuration that defines how Amazon S3 handles bucket notifications.
objectLockConfigurationoptionalIResolvable | CfnBucket.ObjectLockConfigurationPropertyobject_lock_configurationoptionaltyping.Union[IResolvable, ObjectLockConfigurationProperty]objectLockConfigurationoptionalIResolvableObjectLockConfigurationoptionalIResolvableObjectLockConfigurationoptionalinterface{}#
> This operation is not supported for directory buckets.
notes

Places an Object Lock configuration on the specified bucket. The rule specified in the Object Lock configuration will be applied by default to every new object placed in the specified bucket. For more information, see Locking Objects .

  • The DefaultRetention settings require both a mode and a period.
  • The DefaultRetention period can be either Days or Years but you must select one. You cannot specify Days and Years at the same time.
  • You can enable Object Lock for new or existing buckets. For more information, see Configuring Object Lock . > You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt , containing two spaces after my , you must URL encode this value to my%20%20file.txt .
objectLockEnabledoptionalboolean | IResolvableobject_lock_enabledoptionaltyping.Union[bool, IResolvable]objectLockEnabledoptionalBooleanObjectLockEnabledoptionalboolObjectLockEnabledoptionalinterface{}#
Indicates whether this bucket has an Object Lock configuration enabled.

Enable ObjectLockEnabled when you apply ObjectLockConfiguration to a bucket.

ownershipControlsoptionalIResolvable | CfnBucket.OwnershipControlsPropertyownership_controlsoptionaltyping.Union[IResolvable, OwnershipControlsProperty]ownershipControlsoptionalIResolvableOwnershipControlsoptionalIResolvableOwnershipControlsoptionalinterface{}#
Configuration that defines how Amazon S3 handles Object Ownership rules.
publicAccessBlockConfigurationoptionalIResolvable | CfnBucket.PublicAccessBlockConfigurationPropertypublic_access_block_configurationoptionaltyping.Union[IResolvable, PublicAccessBlockConfigurationProperty]publicAccessBlockConfigurationoptionalIResolvablePublicAccessBlockConfigurationoptionalIResolvablePublicAccessBlockConfigurationoptionalinterface{}#
Configuration that defines how Amazon S3 handles public access.
replicationConfigurationoptionalIResolvable | CfnBucket.ReplicationConfigurationPropertyreplication_configurationoptionaltyping.Union[IResolvable, ReplicationConfigurationProperty]replicationConfigurationoptionalIResolvableReplicationConfigurationoptionalIResolvableReplicationConfigurationoptionalinterface{}#
Configuration for replicating objects in an S3 bucket.
notes

To enable replication, you must also enable versioning by using the VersioningConfiguration property.

Amazon S3 can store replicated objects in a single destination bucket or multiple destination buckets. The destination bucket or buckets must already exist.

tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag#
An arbitrary set of tags (key-value pairs) for this S3 bucket.
versioningConfigurationoptionalIResolvable | CfnBucket.VersioningConfigurationPropertyversioning_configurationoptionaltyping.Union[IResolvable, VersioningConfigurationProperty]versioningConfigurationoptionalIResolvableVersioningConfigurationoptionalIResolvableVersioningConfigurationoptionalinterface{}#
Enables multiple versions of all objects in this bucket.
notes

You might enable versioning to prevent objects from being deleted or overwritten by mistake or to archive objects so that you can retrieve previous versions of them.

When you enable versioning on a bucket for the first time, it might take a short amount of time for the change to be fully propagated. We recommend that you wait for 15 minutes after enabling versioning before issuing write operations ( PUT or DELETE ) on objects in the bucket.

websiteConfigurationoptionalIResolvable | CfnBucket.WebsiteConfigurationPropertywebsite_configurationoptionaltyping.Union[IResolvable, WebsiteConfigurationProperty]websiteConfigurationoptionalIResolvableWebsiteConfigurationoptionalIResolvableWebsiteConfigurationoptionalinterface{}#
Information used to configure the bucket as a static website.

For more information, see Hosting Websites on Amazon S3 .

Properties ​

abacStatusmay be undefinedstringabac_statusmay be undefinedstrabacStatusmay be undefinedStringAbacStatusmay be undefinedstringAbacStatusmay be undefined*string#
The ABAC status of the general purpose bucket.
accelerateConfigurationmay be undefinedIResolvable | CfnBucket.AccelerateConfigurationPropertyaccelerate_configurationmay be undefinedtyping.Union[IResolvable, AccelerateConfigurationProperty]accelerateConfigurationmay be undefinedIResolvableAccelerateConfigurationmay be undefinedIResolvableAccelerateConfigurationmay be undefinedinterface{}#
Configures the transfer acceleration state for an Amazon S3 bucket.
accessControlmay be undefinedstringaccess_controlmay be undefinedstraccessControlmay be undefinedStringAccessControlmay be undefinedstringAccessControlmay be undefined*string#
> This is a legacy property, and it is not recommended for most use cases.
analyticsConfigurationsmay be undefinedIResolvable | IResolvable | CfnBucket.AnalyticsConfigurationProperty[]analytics_configurationsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, AnalyticsConfigurationProperty]]]analyticsConfigurationsmay be undefinedIResolvableAnalyticsConfigurationsmay be undefinedIResolvableAnalyticsConfigurationsmay be undefinedinterface{}#
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.
attrArnstringattr_arnstrattrArnStringAttrArnstringAttrArn*string#
Returns the Amazon Resource Name (ARN) of the specified bucket.

Example: arn:aws:s3:::DOC-EXAMPLE-BUCKET

attrDomainNamestringattr_domain_namestrattrDomainNameStringAttrDomainNamestringAttrDomainName*string#
Returns the IPv4 DNS name of the specified bucket.

Example: DOC-EXAMPLE-BUCKET.s3.amazonaws.com

attrDualStackDomainNamestringattr_dual_stack_domain_namestrattrDualStackDomainNameStringAttrDualStackDomainNamestringAttrDualStackDomainName*string#
Returns the IPv6 DNS name of the specified bucket.

Example: DOC-EXAMPLE-BUCKET.s3.dualstack.us-east-2.amazonaws.com

For more information about dual-stack endpoints, see Using Amazon S3 Dual-Stack Endpoints .

attrMetadataConfigurationAnnotationTableConfigurationTableArnstringattr_metadata_configuration_annotation_table_configuration_table_arnstrattrMetadataConfigurationAnnotationTableConfigurationTableArnStringAttrMetadataConfigurationAnnotationTableConfigurationTableArnstringAttrMetadataConfigurationAnnotationTableConfigurationTableArn*string#
The Amazon Resource Name (ARN) for the annotation table.
attrMetadataConfigurationAnnotationTableConfigurationTableNamestringattr_metadata_configuration_annotation_table_configuration_table_namestrattrMetadataConfigurationAnnotationTableConfigurationTableNameStringAttrMetadataConfigurationAnnotationTableConfigurationTableNamestringAttrMetadataConfigurationAnnotationTableConfigurationTableName*string#
The name of the annotation table.
attrMetadataConfigurationDestinationIResolvableattr_metadata_configuration_destinationIResolvableattrMetadataConfigurationDestinationIResolvableAttrMetadataConfigurationDestinationIResolvableAttrMetadataConfigurationDestinationIResolvable#
The destination information for the S3 Metadata configuration.
attrMetadataConfigurationInventoryTableConfigurationTableArnstringattr_metadata_configuration_inventory_table_configuration_table_arnstrattrMetadataConfigurationInventoryTableConfigurationTableArnStringAttrMetadataConfigurationInventoryTableConfigurationTableArnstringAttrMetadataConfigurationInventoryTableConfigurationTableArn*string#
The Amazon Resource Name (ARN) for the inventory table.
attrMetadataConfigurationInventoryTableConfigurationTableNamestringattr_metadata_configuration_inventory_table_configuration_table_namestrattrMetadataConfigurationInventoryTableConfigurationTableNameStringAttrMetadataConfigurationInventoryTableConfigurationTableNamestringAttrMetadataConfigurationInventoryTableConfigurationTableName*string#
The name of the inventory table.
attrMetadataConfigurationJournalTableConfigurationTableArnstringattr_metadata_configuration_journal_table_configuration_table_arnstrattrMetadataConfigurationJournalTableConfigurationTableArnStringAttrMetadataConfigurationJournalTableConfigurationTableArnstringAttrMetadataConfigurationJournalTableConfigurationTableArn*string#
The Amazon Resource Name (ARN) for the journal table.
attrMetadataConfigurationJournalTableConfigurationTableNamestringattr_metadata_configuration_journal_table_configuration_table_namestrattrMetadataConfigurationJournalTableConfigurationTableNameStringAttrMetadataConfigurationJournalTableConfigurationTableNamestringAttrMetadataConfigurationJournalTableConfigurationTableName*string#
The name of the journal table.
attrMetadataTableConfigurationS3TablesDestinationTableArnstringattr_metadata_table_configuration_s3_tables_destination_table_arnstrattrMetadataTableConfigurationS3TablesDestinationTableArnStringAttrMetadataTableConfigurationS3TablesDestinationTableArnstringAttrMetadataTableConfigurationS3TablesDestinationTableArn*string#
The Amazon Resource Name (ARN) for the metadata table in the metadata table configuration.

The specified metadata table name must be unique within the aws_s3_metadata namespace in the destination table bucket.

attrMetadataTableConfigurationS3TablesDestinationTableNamespacestringattr_metadata_table_configuration_s3_tables_destination_table_namespacestrattrMetadataTableConfigurationS3TablesDestinationTableNamespaceStringAttrMetadataTableConfigurationS3TablesDestinationTableNamespacestringAttrMetadataTableConfigurationS3TablesDestinationTableNamespace*string#
The table bucket namespace for the metadata table in your metadata table configuration.

This value is always aws_s3_metadata .

attrRegionalDomainNamestringattr_regional_domain_namestrattrRegionalDomainNameStringAttrRegionalDomainNamestringAttrRegionalDomainName*string#
Returns the regional domain name of the specified bucket.

Example: DOC-EXAMPLE-BUCKET.s3.us-east-2.amazonaws.com

attrWebsiteUrlstringattr_website_urlstrattrWebsiteUrlStringAttrWebsiteUrlstringAttrWebsiteUrl*string#
Returns the Amazon S3 website endpoint for the specified bucket.

Example (IPv4): http://DOC-EXAMPLE-BUCKET.s3-website.us-east-2.amazonaws.com

Example (IPv6): http://DOC-EXAMPLE-BUCKET.s3.dualstack.us-east-2.amazonaws.com

bucketEncryptionmay be undefinedIResolvable | CfnBucket.BucketEncryptionPropertybucket_encryptionmay be undefinedtyping.Union[IResolvable, BucketEncryptionProperty]bucketEncryptionmay be undefinedIResolvableBucketEncryptionmay be undefinedIResolvableBucketEncryptionmay be undefinedinterface{}#
Specifies default encryption for a bucket using server-side encryption with Amazon S3-managed keys (SSE-S3), AWS KMS-managed keys (SSE-KMS), or dual-layer server-side encryption with KMS-managed keys (DSSE-KMS).
bucketNamemay be undefinedstringbucket_namemay be undefinedstrbucketNamemay be undefinedStringBucketNamemay be undefinedstringBucketNamemay be undefined*string#
A name for the bucket.
bucketNamePrefixmay be undefinedstringbucket_name_prefixmay be undefinedstrbucketNamePrefixmay be undefinedStringBucketNamePrefixmay be undefinedstringBucketNamePrefixmay be undefined*string#
bucketNamespacemay be undefinedstringbucket_namespacemay be undefinedstrbucketNamespacemay be undefinedStringBucketNamespacemay be undefinedstringBucketNamespacemay be undefined*string#
A reference to a Bucket resource.
CFN_RESOURCE_TYPE_NAMEstringcfn_resource_type_namestrCFN_RESOURCE_TYPE_NAMEStringCFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAME*stringstatic#
The CloudFormation resource type name for this resource class.
Options for this resource, such as condition, update policy etc.
cfnResourceTypestringcfn_resource_typestrcfnResourceTypeStringCfnResourceTypestringCfnResourceType*string#
AWS resource type.
corsConfigurationmay be undefinedIResolvable | CfnBucket.CorsConfigurationPropertycors_configurationmay be undefinedtyping.Union[IResolvable, CorsConfigurationProperty]corsConfigurationmay be undefinedIResolvableCorsConfigurationmay be undefinedIResolvableCorsConfigurationmay be undefinedinterface{}#
Describes the cross-origin access configuration for objects in an Amazon S3 bucket.
creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*string#
intelligentTieringConfigurationsmay be undefinedIResolvable | IResolvable | CfnBucket.IntelligentTieringConfigurationProperty[]intelligent_tiering_configurationsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, IntelligentTieringConfigurationProperty]]]intelligentTieringConfigurationsmay be undefinedIResolvableIntelligentTieringConfigurationsmay be undefinedIResolvableIntelligentTieringConfigurationsmay be undefinedinterface{}#
Defines how Amazon S3 handles Intelligent-Tiering storage.
inventoryConfigurationsmay be undefinedIResolvable | IResolvable | CfnBucket.InventoryConfigurationProperty[]inventory_configurationsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, InventoryConfigurationProperty]]]inventoryConfigurationsmay be undefinedIResolvableInventoryConfigurationsmay be undefinedIResolvableInventoryConfigurationsmay be undefinedinterface{}#
Specifies the S3 Inventory configuration for an Amazon S3 bucket.
lifecycleConfigurationmay be undefinedIResolvable | CfnBucket.LifecycleConfigurationPropertylifecycle_configurationmay be undefinedtyping.Union[IResolvable, LifecycleConfigurationProperty]lifecycleConfigurationmay be undefinedIResolvableLifecycleConfigurationmay be undefinedIResolvableLifecycleConfigurationmay be undefinedinterface{}#
Specifies the lifecycle configuration for objects in an Amazon S3 bucket.
loggingConfigurationmay be undefinedIResolvable | CfnBucket.LoggingConfigurationPropertylogging_configurationmay be undefinedtyping.Union[IResolvable, LoggingConfigurationProperty]loggingConfigurationmay be undefinedIResolvableLoggingConfigurationmay be undefinedIResolvableLoggingConfigurationmay be undefinedinterface{}#
Settings that define where logs are stored.
logicalIdstringlogical_idstrlogicalIdStringLogicalIdstringLogicalId*string#
The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

metadataConfigurationmay be undefinedIResolvable | CfnBucket.MetadataConfigurationPropertymetadata_configurationmay be undefinedtyping.Union[IResolvable, MetadataConfigurationProperty]metadataConfigurationmay be undefinedIResolvableMetadataConfigurationmay be undefinedIResolvableMetadataConfigurationmay be undefinedinterface{}#
The S3 Metadata configuration for a general purpose bucket.
metadataTableConfigurationmay be undefinedIResolvable | CfnBucket.MetadataTableConfigurationPropertymetadata_table_configurationmay be undefinedtyping.Union[IResolvable, MetadataTableConfigurationProperty]metadataTableConfigurationmay be undefinedIResolvableMetadataTableConfigurationmay be undefinedIResolvableMetadataTableConfigurationmay be undefinedinterface{}#
The metadata table configuration of an Amazon S3 general purpose bucket.
metricsConfigurationsmay be undefinedIResolvable | IResolvable | CfnBucket.MetricsConfigurationProperty[]metrics_configurationsmay be undefinedtyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricsConfigurationProperty]]]metricsConfigurationsmay be undefinedIResolvableMetricsConfigurationsmay be undefinedIResolvableMetricsConfigurationsmay be undefinedinterface{}#
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.
nodeNodenodeNodenodeNodeNodeNodeNodeNode#
The tree node.
notificationConfigurationmay be undefinedIResolvable | CfnBucket.NotificationConfigurationPropertynotification_configurationmay be undefinedtyping.Union[IResolvable, NotificationConfigurationProperty]notificationConfigurationmay be undefinedIResolvableNotificationConfigurationmay be undefinedIResolvableNotificationConfigurationmay be undefinedinterface{}#
Configuration that defines how Amazon S3 handles bucket notifications.
objectLockConfigurationmay be undefinedIResolvable | CfnBucket.ObjectLockConfigurationPropertyobject_lock_configurationmay be undefinedtyping.Union[IResolvable, ObjectLockConfigurationProperty]objectLockConfigurationmay be undefinedIResolvableObjectLockConfigurationmay be undefinedIResolvableObjectLockConfigurationmay be undefinedinterface{}#
> This operation is not supported for directory buckets.
objectLockEnabledmay be undefinedboolean | IResolvableobject_lock_enabledmay be undefinedtyping.Union[bool, IResolvable]objectLockEnabledmay be undefinedBooleanObjectLockEnabledmay be undefinedboolObjectLockEnabledmay be undefinedinterface{}#
Indicates whether this bucket has an Object Lock configuration enabled.
ownershipControlsmay be undefinedIResolvable | CfnBucket.OwnershipControlsPropertyownership_controlsmay be undefinedtyping.Union[IResolvable, OwnershipControlsProperty]ownershipControlsmay be undefinedIResolvableOwnershipControlsmay be undefinedIResolvableOwnershipControlsmay be undefinedinterface{}#
Configuration that defines how Amazon S3 handles Object Ownership rules.
publicAccessBlockConfigurationmay be undefinedIResolvable | CfnBucket.PublicAccessBlockConfigurationPropertypublic_access_block_configurationmay be undefinedtyping.Union[IResolvable, PublicAccessBlockConfigurationProperty]publicAccessBlockConfigurationmay be undefinedIResolvablePublicAccessBlockConfigurationmay be undefinedIResolvablePublicAccessBlockConfigurationmay be undefinedinterface{}#
Configuration that defines how Amazon S3 handles public access.
refstringrefstrrefStringRefstringRef*string#
Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

replicationConfigurationmay be undefinedIResolvable | CfnBucket.ReplicationConfigurationPropertyreplication_configurationmay be undefinedtyping.Union[IResolvable, ReplicationConfigurationProperty]replicationConfigurationmay be undefinedIResolvableReplicationConfigurationmay be undefinedIResolvableReplicationConfigurationmay be undefinedinterface{}#
Configuration for replicating objects in an S3 bucket.
stackStackstackStackstackStackStackStackStackStack#
The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Tag Manager which manages the tags for this resource.
tagsRawmay be undefinedCfnTag[]tags_rawmay be undefinedtyping.List[CfnTag]tagsRawmay be undefinedList<CfnTag>TagsRawmay be undefinedCfnTag[]TagsRawmay be undefined*[]CfnTag#
An arbitrary set of tags (key-value pairs) for this S3 bucket.
versioningConfigurationmay be undefinedIResolvable | CfnBucket.VersioningConfigurationPropertyversioning_configurationmay be undefinedtyping.Union[IResolvable, VersioningConfigurationProperty]versioningConfigurationmay be undefinedIResolvableVersioningConfigurationmay be undefinedIResolvableVersioningConfigurationmay be undefinedinterface{}#
Enables multiple versions of all objects in this bucket.
websiteConfigurationmay be undefinedIResolvable | CfnBucket.WebsiteConfigurationPropertywebsite_configurationmay be undefinedtyping.Union[IResolvable, WebsiteConfigurationProperty]websiteConfigurationmay be undefinedIResolvableWebsiteConfigurationmay be undefinedIResolvableWebsiteConfigurationmay be undefinedinterface{}#
Information used to configure the bucket as a static website.

Methods ​

addDeletionOverride(path: string): voiddef add_deletion_override(self, path: str) -> Nonepublic void addDeletionOverride(String path)public void AddDeletionOverride(string path)func AddDeletionOverride(Path *string)#
Syntactic sugar for `addOverride(path, undefined)`.
1 parameter

Parameters

  • pathpathpathpathPath — The path of the value to delete.
addDependency(target: CfnResource): voiddef add_dependency(self, target: CfnResource) -> Nonepublic void addDependency(CfnResource target)public void AddDependency(CfnResource target)func AddDependency(Target CfnResource)deprecated#
Use `addResourceDependency` instead.

This method has been renamed to addResourceDependency to more clearly set it apart from construct.node.addDependency. See the documentation of that function for more details.

addDependsOn(target: CfnResource): voiddef add_depends_on(self, target: CfnResource) -> Nonepublic void addDependsOn(CfnResource target)public void AddDependsOn(CfnResource target)func AddDependsOn(Target CfnResource)deprecated#
Use `addResourceDependency` instead.
notes

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

This method has been renamed to addResourceDependency, which makes it more clear that this method operates at a different level from the construct-level construct.node.addDependency() mechanism.

addMetadata(key: string, value: any): voiddef add_metadata(self, key: str, value: Any) -> Nonepublic void addMetadata(String key, Object value)public void AddMetadata(string key, object value)func AddMetadata(Key *string, Value interface{})#
Add a value to the CloudFormation Resource Metadata.
addOverride(path: string, value: any): voiddef add_override(self, path: str, value: Any) -> Nonepublic void addOverride(String path, Object value)public void AddOverride(string path, object value)func AddOverride(Path *string, Value interface{})#
Adds an override to the synthesized CloudFormation resource.
notes · 2 parameters

To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

typescript
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');

would add the overrides

json
"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters

  • pathpathpathpathPath — - The path of the property, you can use dot notation to override values in complex types.
  • valuevaluevaluevalueValue — - The value.
addPropertyDeletionOverride(propertyPath: string): voiddef add_property_deletion_override(self, property_path: str) -> Nonepublic void addPropertyDeletionOverride(String propertyPath)public void AddPropertyDeletionOverride(string propertyPath)func AddPropertyDeletionOverride(PropertyPath *string)#
Adds an override that deletes the value of a property from the resource definition.
1 parameter

Parameters

  • propertyPathproperty_pathpropertyPathpropertyPathPropertyPath — The path to the property.
addPropertyOverride(propertyPath: string, value: any): voiddef add_property_override(self, property_path: str, value: Any) -> Nonepublic void addPropertyOverride(String propertyPath, Object value)public void AddPropertyOverride(string propertyPath, object value)func AddPropertyOverride(PropertyPath *string, Value interface{})#
Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

2 parameters

Parameters

  • propertyPathproperty_pathpropertyPathpropertyPathPropertyPath — The path of the property.
  • valuevaluevaluevalueValue — The value.
addResourceDependency(target: CfnResource, reason?: string): voiddef add_resource_dependency(self, target: CfnResource, reason: typing.Optional[str] = None) -> Nonepublic void addResourceDependency(CfnResource target, String reason)public void AddResourceDependency(CfnResource target, string? reason = null)func AddResourceDependency(Target CfnResource, Reason *string)#
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
notes

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

This method only adds dependencies between L1 resources. If you are looking for a generic construct-to-construct dependency mechanism that works for all constructs including L2s, use construct.node.addDependency instead.

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Sets the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.

1 parameter

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): voiddef apply_removal_policy(self, policy: typing.Optional[RemovalPolicy] = None, options: typing.Optional[RemovalPolicyOptions] = None) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy, RemovalPolicyOptions options)public void ApplyRemovalPolicy(RemovalPolicy? policy = null, RemovalPolicyOptions? options = null)func ApplyRemovalPolicy(Policy RemovalPolicy, Options RemovalPolicyOptions)#
Sets the deletion policy of the resource based on the removal policy specified.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

arnForBucket(resource: IBucketRef): string@staticmethod def arn_for_bucket(resource: IBucketRef) -> strpublic static String arnForBucket(IBucketRef resource)public static string ArnForBucket(IBucketRef resource)func ArnForBucket(Resource IBucketRef) *stringstatic#
cfnPropertyName(cdkPropertyName: string): stringdef cfn_property_name(self, cdk_property_name: str) -> strpublic String cfnPropertyName(String cdkPropertyName)public string CfnPropertyName(string cdkPropertyName)func CfnPropertyName(CdkPropertyName *string) *string#
fromBucketArn(scope: Construct, id: string, arn: string): IBucketRef@staticmethod def from_bucket_arn(scope: Construct, id: str, arn: str) -> IBucketRefpublic static IBucketRef fromBucketArn(Construct scope, String id, String arn)public static IBucketRef FromBucketArn(Construct scope, string id, string arn)func FromBucketArn(Scope Construct, Id *string, Arn *string) IBucketRefstatic#
Creates a new IBucketRef from an ARN.
fromBucketName(scope: Construct, id: string, bucketName: string): IBucketRef@staticmethod def from_bucket_name(scope: Construct, id: str, bucket_name: str) -> IBucketRefpublic static IBucketRef fromBucketName(Construct scope, String id, String bucketName)public static IBucketRef FromBucketName(Construct scope, string id, string bucketName)func FromBucketName(Scope Construct, Id *string, BucketName *string) IBucketRefstatic#
Creates a new IBucketRef from a bucketName.
getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Referencedef get_att(self, attribute_name: str, type_hint: typing.Optional[ResolutionTypeHint] = None) -> Referencepublic Reference getAtt(String attributeName, ResolutionTypeHint typeHint)public Reference GetAtt(string attributeName, ResolutionTypeHint? typeHint = null)func GetAtt(AttributeName *string, TypeHint ResolutionTypeHint) Reference#
Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

1 parameter

Parameters

  • attributeNameattribute_nameattributeNameattributeNameAttributeName — The name of the attribute.
getMetadata(key: string): anydef get_metadata(self, key: str) -> Anypublic Object getMetadata(String key)public object GetMetadata(string key)func GetMetadata(Key *string) interface{}#
Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector: TreeInspector): voiddef inspect(self, inspector: TreeInspector) -> Nonepublic void inspect(TreeInspector inspector)public void Inspect(TreeInspector inspector)func Inspect(Inspector TreeInspector)#
Examines the CloudFormation resource and discloses attributes.
1 parameter

Parameters

  • inspectorinspectorinspectorinspectorInspector — tree inspector to collect and process attributes.
isCfnBucket(x: any): boolean@staticmethod def is_cfn_bucket(x: Any) -> boolpublic static Boolean isCfnBucket(Object x)public static bool IsCfnBucket(object x)func IsCfnBucket(X interface{}) *boolstatic#
Checks whether the given object is a CfnBucket.
isCfnElement(x: any): boolean@staticmethod def is_cfn_element(x: Any) -> boolpublic static Boolean isCfnElement(Object x)public static bool IsCfnElement(object x)func IsCfnElement(X interface{}) *boolstatic#
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

returns

Returns: The construct as a stack element or undefined if it is not a stack element.

isCfnResource(x: any): boolean@staticmethod def is_cfn_resource(x: Any) -> boolpublic static Boolean isCfnResource(Object x)public static bool IsCfnResource(object x)func IsCfnResource(X interface{}) *boolstatic#
Check whether the given object is a CfnResource.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

obtainDependencies(): Stack | CfnResource[]def obtain_dependencies(self, ) -> typing.List[typing.Union[Stack, CfnResource]]public List<Stack> obtainDependencies()public Stack[] ObtainDependencies()func ObtainDependencies() *[]interface{}#
Retrieves an array of resources and stacks this resource depends on.

For resources depended on directly, returns the CfnResource object. For dependencies on other stacks, returns the Stack object. The order of the array is not guaranteed.

overrideLogicalId(newLogicalId: string): voiddef override_logical_id(self, new_logical_id: str) -> Nonepublic void overrideLogicalId(String newLogicalId)public void OverrideLogicalId(string newLogicalId)func OverrideLogicalId(NewLogicalId *string)#
Overrides the auto-generated logical ID with a specific ID.
1 parameter

Parameters

  • newLogicalIdnew_logical_idnewLogicalIdnewLogicalIdNewLogicalId — The new logical ID to use for this stack element.
removeDependency(target: CfnResource): voiddef remove_dependency(self, target: CfnResource) -> Nonepublic void removeDependency(CfnResource target)public void RemoveDependency(CfnResource target)func RemoveDependency(Target CfnResource)deprecated#
Use `removeResourceDependency` instead

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

removeResourceDependency(target: CfnResource): voiddef remove_resource_dependency(self, target: CfnResource) -> Nonepublic void removeResourceDependency(CfnResource target)public void RemoveResourceDependency(CfnResource target)func RemoveResourceDependency(Target CfnResource)#
Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

replaceDependency(target: CfnResource, newTarget: CfnResource): voiddef replace_dependency(self, target: CfnResource, new_target: CfnResource) -> Nonepublic void replaceDependency(CfnResource target, CfnResource newTarget)public void ReplaceDependency(CfnResource target, CfnResource newTarget)func ReplaceDependency(Target CfnResource, NewTarget CfnResource)#
Replaces one dependency with another.
2 parameters

Parameters

  • targettargettargettargetTarget — The dependency to replace.
  • newTargetnew_targetnewTargetnewTargetNewTarget — The new dependency to add.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
returns

Returns: a string representation of this resource

with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.