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
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],
}));
# 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]
))
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());
// 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 }
}));
// 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
new CfnBucket(scope: Construct, id: string, props?: CfnBucketProps)
CfnBucket(scope: Construct, id: str, props: typing.Optional[CfnBucketProps] = None)
new CfnBucket(Construct scope, String id, CfnBucketProps props)
new CfnBucket(Construct scope, string id, CfnBucketProps? props = null)
NewCfnBucket(Scope Construct, Id *string, Props CfnBucketProps)
Construct Props
abacStatusoptionalstringabac_statusoptionalstrabacStatusoptionalStringAbacStatusoptionalstringAbacStatusoptional*string#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{}#For more information, see Amazon S3 Transfer Acceleration in the Amazon S3 User Guide .
accessControloptionalstringaccess_controloptionalstraccessControloptionalStringAccessControloptionalstringAccessControloptional*string#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{}#bucketEncryptionoptionalIResolvable | CfnBucket.BucketEncryptionPropertybucket_encryptionoptionaltyping.Union[IResolvable, BucketEncryptionProperty]bucketEncryptionoptionalIResolvableBucketEncryptionoptionalIResolvableBucketEncryptionoptionalinterface{}#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#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{}#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{}#inventoryConfigurationsoptionalIResolvable | IResolvable | CfnBucket.InventoryConfigurationProperty[]inventory_configurationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, InventoryConfigurationProperty]]]inventoryConfigurationsoptionalIResolvableInventoryConfigurationsoptionalIResolvableInventoryConfigurationsoptionalinterface{}#For more information, see GET Bucket inventory in the Amazon S3 API Reference .
lifecycleConfigurationoptionalIResolvable | CfnBucket.LifecycleConfigurationPropertylifecycle_configurationoptionaltyping.Union[IResolvable, LifecycleConfigurationProperty]lifecycleConfigurationoptionalIResolvableLifecycleConfigurationoptionalIResolvableLifecycleConfigurationoptionalinterface{}#For more information, see Object Lifecycle Management in the Amazon S3 User Guide .
loggingConfigurationoptionalIResolvable | CfnBucket.LoggingConfigurationPropertylogging_configurationoptionaltyping.Union[IResolvable, LoggingConfigurationProperty]loggingConfigurationoptionalIResolvableLoggingConfigurationoptionalIResolvableLoggingConfigurationoptionalinterface{}#metadataConfigurationoptionalIResolvable | CfnBucket.MetadataConfigurationPropertymetadata_configurationoptionaltyping.Union[IResolvable, MetadataConfigurationProperty]metadataConfigurationoptionalIResolvableMetadataConfigurationoptionalIResolvableMetadataConfigurationoptionalinterface{}#metadataTableConfigurationoptionalIResolvable | CfnBucket.MetadataTableConfigurationPropertymetadata_table_configurationoptionaltyping.Union[IResolvable, MetadataTableConfigurationProperty]metadataTableConfigurationoptionalIResolvableMetadataTableConfigurationoptionalIResolvableMetadataTableConfigurationoptionalinterface{}#metricsConfigurationsoptionalIResolvable | IResolvable | CfnBucket.MetricsConfigurationProperty[]metrics_configurationsoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, MetricsConfigurationProperty]]]metricsConfigurationsoptionalIResolvableMetricsConfigurationsoptionalIResolvableMetricsConfigurationsoptionalinterface{}#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{}#objectLockConfigurationoptionalIResolvable | CfnBucket.ObjectLockConfigurationPropertyobject_lock_configurationoptionaltyping.Union[IResolvable, ObjectLockConfigurationProperty]objectLockConfigurationoptionalIResolvableObjectLockConfigurationoptionalIResolvableObjectLockConfigurationoptionalinterface{}#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
DefaultRetentionsettings require both a mode and a period.- The
DefaultRetentionperiod can be eitherDaysorYearsbut you must select one. You cannot specifyDaysandYearsat 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 aftermy, you must URL encode this value tomy%20%20file.txt.
objectLockEnabledoptionalboolean | IResolvableobject_lock_enabledoptionaltyping.Union[bool, IResolvable]objectLockEnabledoptionalBooleanObjectLockEnabledoptionalboolObjectLockEnabledoptionalinterface{}#Enable ObjectLockEnabled when you apply ObjectLockConfiguration to a bucket.
ownershipControlsoptionalIResolvable | CfnBucket.OwnershipControlsPropertyownership_controlsoptionaltyping.Union[IResolvable, OwnershipControlsProperty]ownershipControlsoptionalIResolvableOwnershipControlsoptionalIResolvableOwnershipControlsoptionalinterface{}#publicAccessBlockConfigurationoptionalIResolvable | CfnBucket.PublicAccessBlockConfigurationPropertypublic_access_block_configurationoptionaltyping.Union[IResolvable, PublicAccessBlockConfigurationProperty]publicAccessBlockConfigurationoptionalIResolvablePublicAccessBlockConfigurationoptionalIResolvablePublicAccessBlockConfigurationoptionalinterface{}#replicationConfigurationoptionalIResolvable | CfnBucket.ReplicationConfigurationPropertyreplication_configurationoptionaltyping.Union[IResolvable, ReplicationConfigurationProperty]replicationConfigurationoptionalIResolvableReplicationConfigurationoptionalIResolvableReplicationConfigurationoptionalinterface{}#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#versioningConfigurationoptionalIResolvable | CfnBucket.VersioningConfigurationPropertyversioning_configurationoptionaltyping.Union[IResolvable, VersioningConfigurationProperty]versioningConfigurationoptionalIResolvableVersioningConfigurationoptionalIResolvableVersioningConfigurationoptionalinterface{}#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 (
PUTorDELETE) on objects in the bucket.
websiteConfigurationoptionalIResolvable | CfnBucket.WebsiteConfigurationPropertywebsite_configurationoptionaltyping.Union[IResolvable, WebsiteConfigurationProperty]websiteConfigurationoptionalIResolvableWebsiteConfigurationoptionalIResolvableWebsiteConfigurationoptionalinterface{}#For more information, see Hosting Websites on Amazon S3 .
Properties
abacStatusmay be undefinedstringabac_statusmay be undefinedstrabacStatusmay be undefinedStringAbacStatusmay be undefinedstringAbacStatusmay be undefined*string#accelerateConfigurationmay be undefinedIResolvable | CfnBucket.AccelerateConfigurationPropertyaccelerate_configurationmay be undefinedtyping.Union[IResolvable, AccelerateConfigurationProperty]accelerateConfigurationmay be undefinedIResolvableAccelerateConfigurationmay be undefinedIResolvableAccelerateConfigurationmay be undefinedinterface{}#accessControlmay be undefinedstringaccess_controlmay be undefinedstraccessControlmay be undefinedStringAccessControlmay be undefinedstringAccessControlmay be undefined*string#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{}#Example: arn:aws:s3:::DOC-EXAMPLE-BUCKET
attrDomainNamestringattr_domain_namestrattrDomainNameStringAttrDomainNamestringAttrDomainName*string#Example: DOC-EXAMPLE-BUCKET.s3.amazonaws.com
attrDualStackDomainNamestringattr_dual_stack_domain_namestrattrDualStackDomainNameStringAttrDualStackDomainNamestringAttrDualStackDomainName*string#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#attrMetadataConfigurationAnnotationTableConfigurationTableNamestringattr_metadata_configuration_annotation_table_configuration_table_namestrattrMetadataConfigurationAnnotationTableConfigurationTableNameStringAttrMetadataConfigurationAnnotationTableConfigurationTableNamestringAttrMetadataConfigurationAnnotationTableConfigurationTableName*string#attrMetadataConfigurationDestinationIResolvableattr_metadata_configuration_destinationIResolvableattrMetadataConfigurationDestinationIResolvableAttrMetadataConfigurationDestinationIResolvableAttrMetadataConfigurationDestinationIResolvable#attrMetadataConfigurationInventoryTableConfigurationTableArnstringattr_metadata_configuration_inventory_table_configuration_table_arnstrattrMetadataConfigurationInventoryTableConfigurationTableArnStringAttrMetadataConfigurationInventoryTableConfigurationTableArnstringAttrMetadataConfigurationInventoryTableConfigurationTableArn*string#attrMetadataConfigurationInventoryTableConfigurationTableNamestringattr_metadata_configuration_inventory_table_configuration_table_namestrattrMetadataConfigurationInventoryTableConfigurationTableNameStringAttrMetadataConfigurationInventoryTableConfigurationTableNamestringAttrMetadataConfigurationInventoryTableConfigurationTableName*string#attrMetadataConfigurationJournalTableConfigurationTableArnstringattr_metadata_configuration_journal_table_configuration_table_arnstrattrMetadataConfigurationJournalTableConfigurationTableArnStringAttrMetadataConfigurationJournalTableConfigurationTableArnstringAttrMetadataConfigurationJournalTableConfigurationTableArn*string#attrMetadataConfigurationJournalTableConfigurationTableNamestringattr_metadata_configuration_journal_table_configuration_table_namestrattrMetadataConfigurationJournalTableConfigurationTableNameStringAttrMetadataConfigurationJournalTableConfigurationTableNamestringAttrMetadataConfigurationJournalTableConfigurationTableName*string#attrMetadataTableConfigurationS3TablesDestinationTableArnstringattr_metadata_table_configuration_s3_tables_destination_table_arnstrattrMetadataTableConfigurationS3TablesDestinationTableArnStringAttrMetadataTableConfigurationS3TablesDestinationTableArnstringAttrMetadataTableConfigurationS3TablesDestinationTableArn*string#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#This value is always aws_s3_metadata .
attrRegionalDomainNamestringattr_regional_domain_namestrattrRegionalDomainNameStringAttrRegionalDomainNamestringAttrRegionalDomainName*string#Example: DOC-EXAMPLE-BUCKET.s3.us-east-2.amazonaws.com
attrWebsiteUrlstringattr_website_urlstrattrWebsiteUrlStringAttrWebsiteUrlstringAttrWebsiteUrl*string#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{}#bucketNamemay be undefinedstringbucket_namemay be undefinedstrbucketNamemay be undefinedStringBucketNamemay be undefinedstringBucketNamemay be undefined*string#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#bucketRefBucketReferencebucket_refBucketReferencebucketRefBucketReferenceBucketRefBucketReferenceBucketRefBucketReference#CFN_RESOURCE_TYPE_NAMEstringcfn_resource_type_namestrCFN_RESOURCE_TYPE_NAMEStringCFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAME*stringstatic#cfnOptionsICfnResourceOptionscfn_optionsICfnResourceOptionscfnOptionsICfnResourceOptionsCfnOptionsICfnResourceOptionsCfnOptionsICfnResourceOptions#cfnResourceTypestringcfn_resource_typestrcfnResourceTypeStringCfnResourceTypestringCfnResourceType*string#corsConfigurationmay be undefinedIResolvable | CfnBucket.CorsConfigurationPropertycors_configurationmay be undefinedtyping.Union[IResolvable, CorsConfigurationProperty]corsConfigurationmay be undefinedIResolvableCorsConfigurationmay be undefinedIResolvableCorsConfigurationmay be undefinedinterface{}#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{}#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{}#lifecycleConfigurationmay be undefinedIResolvable | CfnBucket.LifecycleConfigurationPropertylifecycle_configurationmay be undefinedtyping.Union[IResolvable, LifecycleConfigurationProperty]lifecycleConfigurationmay be undefinedIResolvableLifecycleConfigurationmay be undefinedIResolvableLifecycleConfigurationmay be undefinedinterface{}#loggingConfigurationmay be undefinedIResolvable | CfnBucket.LoggingConfigurationPropertylogging_configurationmay be undefinedtyping.Union[IResolvable, LoggingConfigurationProperty]loggingConfigurationmay be undefinedIResolvableLoggingConfigurationmay be undefinedIResolvableLoggingConfigurationmay be undefinedinterface{}#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{}#metadataTableConfigurationmay be undefinedIResolvable | CfnBucket.MetadataTableConfigurationPropertymetadata_table_configurationmay be undefinedtyping.Union[IResolvable, MetadataTableConfigurationProperty]metadataTableConfigurationmay be undefinedIResolvableMetadataTableConfigurationmay be undefinedIResolvableMetadataTableConfigurationmay be undefinedinterface{}#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{}#notificationConfigurationmay be undefinedIResolvable | CfnBucket.NotificationConfigurationPropertynotification_configurationmay be undefinedtyping.Union[IResolvable, NotificationConfigurationProperty]notificationConfigurationmay be undefinedIResolvableNotificationConfigurationmay be undefinedIResolvableNotificationConfigurationmay be undefinedinterface{}#objectLockConfigurationmay be undefinedIResolvable | CfnBucket.ObjectLockConfigurationPropertyobject_lock_configurationmay be undefinedtyping.Union[IResolvable, ObjectLockConfigurationProperty]objectLockConfigurationmay be undefinedIResolvableObjectLockConfigurationmay be undefinedIResolvableObjectLockConfigurationmay be undefinedinterface{}#objectLockEnabledmay be undefinedboolean | IResolvableobject_lock_enabledmay be undefinedtyping.Union[bool, IResolvable]objectLockEnabledmay be undefinedBooleanObjectLockEnabledmay be undefinedboolObjectLockEnabledmay be undefinedinterface{}#ownershipControlsmay be undefinedIResolvable | CfnBucket.OwnershipControlsPropertyownership_controlsmay be undefinedtyping.Union[IResolvable, OwnershipControlsProperty]ownershipControlsmay be undefinedIResolvableOwnershipControlsmay be undefinedIResolvableOwnershipControlsmay be undefinedinterface{}#publicAccessBlockConfigurationmay be undefinedIResolvable | CfnBucket.PublicAccessBlockConfigurationPropertypublic_access_block_configurationmay be undefinedtyping.Union[IResolvable, PublicAccessBlockConfigurationProperty]publicAccessBlockConfigurationmay be undefinedIResolvablePublicAccessBlockConfigurationmay be undefinedIResolvablePublicAccessBlockConfigurationmay be undefinedinterface{}#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{}#CfnElements must be defined within a stack scope (directly or indirectly).
tagsRawmay be undefinedCfnTag[]tags_rawmay be undefinedtyping.List[CfnTag]tagsRawmay be undefinedList<CfnTag>TagsRawmay be undefinedCfnTag[]TagsRawmay be undefined*[]CfnTag#versioningConfigurationmay be undefinedIResolvable | CfnBucket.VersioningConfigurationPropertyversioning_configurationmay be undefinedtyping.Union[IResolvable, VersioningConfigurationProperty]versioningConfigurationmay be undefinedIResolvableVersioningConfigurationmay be undefinedIResolvableVersioningConfigurationmay be undefinedinterface{}#websiteConfigurationmay be undefinedIResolvable | CfnBucket.WebsiteConfigurationPropertywebsite_configurationmay be undefinedtyping.Union[IResolvable, WebsiteConfigurationProperty]websiteConfigurationmay be undefinedIResolvableWebsiteConfigurationmay be undefinedIResolvableWebsiteConfigurationmay be undefinedinterface{}#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)#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#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#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{})#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{})#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,
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
would add the overrides
"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)#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{})#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)#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)#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)#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#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#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#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{}#inspect(inspector: TreeInspector): voiddef inspect(self, inspector: TreeInspector) -> Nonepublic void inspect(TreeInspector inspector)public void Inspect(TreeInspector inspector)func Inspect(Inspector TreeInspector)#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#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#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#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#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{}#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)#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#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)#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)#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
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#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.