Class CfnBucket
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
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:
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());
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Specifies the days since the initiation of an incomplete multipart upload that Amazon S3 will wait before permanently removing all parts of the upload.static interface
Configures the transfer acceleration state for an Amazon S3 bucket.static interface
Specify this only in a cross-account scenario (where source and destination bucket owners are not the same), and you want to change replica ownership to the AWS account that owns the destination bucket.static interface
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.static interface
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).static final class
A fluent builder forCfnBucket
.static interface
Describes the cross-origin access configuration for objects in an Amazon S3 bucket.static interface
Specifies a cross-origin access rule for an Amazon S3 bucket.static interface
Specifies how data related to the storage class analysis for an Amazon S3 bucket should be exported.static interface
The container element for optionally specifying the default Object Lock retention settings for new objects placed in the specified bucket.static interface
Specifies whether Amazon S3 replicates delete markers.static interface
Specifies information about where to publish analysis or configuration results for an Amazon S3 bucket.static interface
Specifies encryption-related information for an Amazon S3 bucket that is a destination for replicated objects.static interface
Amazon S3 can send events to Amazon EventBridge whenever certain events happen in your bucket, see Using EventBridge in the Amazon S3 User Guide .static interface
Specifies the Amazon S3 object key name to filter on.static interface
Specifies the S3 Intelligent-Tiering configuration for an Amazon S3 bucket.static interface
Specifies the inventory configuration for an Amazon S3 bucket.static interface
Describes the AWS Lambda functions to invoke and the events for which to invoke them.static interface
Specifies the lifecycle configuration for objects in an Amazon S3 bucket.static interface
Describes where logs are stored and the prefix that Amazon S3 assigns to all log object keys for a bucket.static interface
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.static interface
A container specifying replication metrics-related settings enabling replication metrics and events.static interface
Specifies when noncurrent object versions expire.static interface
Container for the transition rule that describes when noncurrent objects transition to theSTANDARD_IA
,ONEZONE_IA
,INTELLIGENT_TIERING
,GLACIER_IR
,GLACIER
, orDEEP_ARCHIVE
storage class.static interface
Describes the notification configuration for an Amazon S3 bucket.static interface
Specifies object key name filtering rules.static interface
Places an Object Lock configuration on the specified bucket.static interface
Specifies the Object Lock rule for the specified object.static interface
Specifies the container element for Object Ownership rules.static interface
Specifies an Object Ownership rule.static interface
Amazon S3 keys for log objects are partitioned in the following format:.static interface
The PublicAccessBlock configuration that you want to apply to this Amazon S3 bucket.static interface
Specifies the configuration for publishing messages to an Amazon Simple Queue Service (Amazon SQS) queue when Amazon S3 detects specified events.static interface
Specifies the redirect behavior of all requests to a website endpoint of an Amazon S3 bucket.static interface
Specifies how requests are redirected.static interface
A filter that you can specify for selection for modifications on replicas.static interface
A container for replication rules.static interface
A container for information about the replication destination and its configurations including enabling the S3 Replication Time Control (S3 RTC).static interface
A container for specifying rule filters.static interface
A filter that identifies the subset of objects to which the replication rule applies.static interface
Specifies which Amazon S3 objects to replicate and where to store the replicas.static interface
A container specifying S3 Replication Time Control (S3 RTC) related information, including whether S3 RTC is enabled and the time when all objects and operations on objects must be replicated.static interface
A container specifying the time value for S3 Replication Time Control (S3 RTC) and replication metricsEventThreshold
.static interface
A container for describing a condition that must be met for the specified redirect to apply.static interface
Specifies the redirect behavior and when a redirect is applied.static interface
Specifies lifecycle rules for an Amazon S3 bucket.static interface
A container for object key name prefix and suffix filtering rules.static interface
Describes the default server-side encryption to apply to new objects in the bucket.static interface
Specifies the default server-side encryption configuration.static interface
A container that describes additional filters for identifying the source objects that you want to replicate.static interface
A container for filter information for the selection of S3 objects encrypted with AWS KMS.static interface
Specifies data related to access patterns to be collected and made available to analyze the tradeoffs between different storage classes for an Amazon S3 bucket.static interface
Specifies tags to use to identify a subset of objects for an Amazon S3 bucket.static interface
Amazon S3 key format for log objects.static interface
The S3 Intelligent-Tiering storage class is designed to optimize storage costs by automatically moving data to the most cost-effective storage access tier, without additional operational overhead.static interface
A container for specifying the configuration for publication of messages to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 detects specified events.static interface
Specifies when an object transitions to a specified storage class.static interface
Describes the versioning state of an Amazon S3 bucket.static interface
Specifies website configuration parameters for an Amazon S3 bucket.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnBucket
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnBucket
(software.amazon.jsii.JsiiObjectRef objRef) CfnBucket
(software.constructs.Construct scope, String id, CfnBucketProps props) -
Method Summary
Modifier and TypeMethodDescriptionConfigures the transfer acceleration state for an Amazon S3 bucket.Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.Returns the Amazon Resource Name (ARN) of the specified bucket.Returns the IPv4 DNS name of the specified bucket.Returns the IPv6 DNS name of the specified bucket.Returns the regional domain name of the specified bucket.Returns the Amazon S3 website endpoint for the specified bucket.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).A name for the bucket.Describes the cross-origin access configuration for objects in an Amazon S3 bucket.Defines how Amazon S3 handles Intelligent-Tiering storage.Specifies the inventory configuration for an Amazon S3 bucket.Specifies the lifecycle configuration for objects in an Amazon S3 bucket.Settings that define where logs are stored.Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.Configuration that defines how Amazon S3 handles bucket notifications.Indicates whether this bucket has an Object Lock configuration enabled.Configuration that defines how Amazon S3 handles Object Ownership rules.Configuration that defines how Amazon S3 handles public access.Configuration for replicating objects in an S3 bucket.getTags()
Tag Manager which manages the tags for this resource.An arbitrary set of tags (key-value pairs) for this S3 bucket.Enables multiple versions of all objects in this bucket.Information used to configure the bucket as a static website.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
Configures the transfer acceleration state for an Amazon S3 bucket.void
Configures the transfer acceleration state for an Amazon S3 bucket.void
setAccessControl
(String value) void
setAnalyticsConfigurations
(List<Object> value) Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.void
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.void
setBucketEncryption
(IResolvable value) 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).void
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).void
setBucketName
(String value) A name for the bucket.void
setCorsConfiguration
(IResolvable value) Describes the cross-origin access configuration for objects in an Amazon S3 bucket.void
Describes the cross-origin access configuration for objects in an Amazon S3 bucket.void
Defines how Amazon S3 handles Intelligent-Tiering storage.void
Defines how Amazon S3 handles Intelligent-Tiering storage.void
setInventoryConfigurations
(List<Object> value) Specifies the inventory configuration for an Amazon S3 bucket.void
Specifies the inventory configuration for an Amazon S3 bucket.void
Specifies the lifecycle configuration for objects in an Amazon S3 bucket.void
Specifies the lifecycle configuration for objects in an Amazon S3 bucket.void
Settings that define where logs are stored.void
Settings that define where logs are stored.void
setMetricsConfigurations
(List<Object> value) Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.void
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.void
Configuration that defines how Amazon S3 handles bucket notifications.void
Configuration that defines how Amazon S3 handles bucket notifications.void
void
void
setObjectLockEnabled
(Boolean value) Indicates whether this bucket has an Object Lock configuration enabled.void
setObjectLockEnabled
(IResolvable value) Indicates whether this bucket has an Object Lock configuration enabled.void
setOwnershipControls
(IResolvable value) Configuration that defines how Amazon S3 handles Object Ownership rules.void
Configuration that defines how Amazon S3 handles Object Ownership rules.void
Configuration that defines how Amazon S3 handles public access.void
Configuration that defines how Amazon S3 handles public access.void
Configuration for replicating objects in an S3 bucket.void
Configuration for replicating objects in an S3 bucket.void
setTagsRaw
(List<CfnTag> value) An arbitrary set of tags (key-value pairs) for this S3 bucket.void
Enables multiple versions of all objects in this bucket.void
Enables multiple versions of all objects in this bucket.void
Information used to configure the bucket as a static website.void
Information used to configure the bucket as a static website.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnBucket
protected CfnBucket(software.amazon.jsii.JsiiObjectRef objRef) -
CfnBucket
protected CfnBucket(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnBucket
@Stability(Stable) public CfnBucket(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnBucketProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties.
-
CfnBucket
@Stability(Stable) public CfnBucket(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
Returns the Amazon Resource Name (ARN) of the specified bucket.Example:
arn:aws:s3:::DOC-EXAMPLE-BUCKET
-
getAttrDomainName
Returns the IPv4 DNS name of the specified bucket.Example:
DOC-EXAMPLE-BUCKET.s3.amazonaws.com
-
getAttrDualStackDomainName
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 .
-
getAttrRegionalDomainName
Returns the regional domain name of the specified bucket.Example:
DOC-EXAMPLE-BUCKET.s3.us-east-2.amazonaws.com
-
getAttrWebsiteUrl
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
-
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getAccelerateConfiguration
Configures the transfer acceleration state for an Amazon S3 bucket. -
setAccelerateConfiguration
Configures the transfer acceleration state for an Amazon S3 bucket. -
setAccelerateConfiguration
@Stability(Stable) public void setAccelerateConfiguration(@Nullable CfnBucket.AccelerateConfigurationProperty value) Configures the transfer acceleration state for an Amazon S3 bucket. -
getAccessControl
This is a legacy property, and it is not recommended for most use cases.
-
setAccessControl
This is a legacy property, and it is not recommended for most use cases.
-
getAnalyticsConfigurations
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket. -
setAnalyticsConfigurations
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket. -
setAnalyticsConfigurations
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket. -
getBucketEncryption
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). -
setBucketEncryption
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). -
setBucketEncryption
@Stability(Stable) public void setBucketEncryption(@Nullable CfnBucket.BucketEncryptionProperty value) 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). -
getBucketName
A name for the bucket. -
setBucketName
A name for the bucket. -
getCorsConfiguration
Describes the cross-origin access configuration for objects in an Amazon S3 bucket. -
setCorsConfiguration
Describes the cross-origin access configuration for objects in an Amazon S3 bucket. -
setCorsConfiguration
@Stability(Stable) public void setCorsConfiguration(@Nullable CfnBucket.CorsConfigurationProperty value) Describes the cross-origin access configuration for objects in an Amazon S3 bucket. -
getIntelligentTieringConfigurations
Defines how Amazon S3 handles Intelligent-Tiering storage. -
setIntelligentTieringConfigurations
Defines how Amazon S3 handles Intelligent-Tiering storage. -
setIntelligentTieringConfigurations
Defines how Amazon S3 handles Intelligent-Tiering storage. -
getInventoryConfigurations
Specifies the inventory configuration for an Amazon S3 bucket. -
setInventoryConfigurations
Specifies the inventory configuration for an Amazon S3 bucket. -
setInventoryConfigurations
Specifies the inventory configuration for an Amazon S3 bucket. -
getLifecycleConfiguration
Specifies the lifecycle configuration for objects in an Amazon S3 bucket. -
setLifecycleConfiguration
Specifies the lifecycle configuration for objects in an Amazon S3 bucket. -
setLifecycleConfiguration
@Stability(Stable) public void setLifecycleConfiguration(@Nullable CfnBucket.LifecycleConfigurationProperty value) Specifies the lifecycle configuration for objects in an Amazon S3 bucket. -
getLoggingConfiguration
Settings that define where logs are stored. -
setLoggingConfiguration
Settings that define where logs are stored. -
setLoggingConfiguration
@Stability(Stable) public void setLoggingConfiguration(@Nullable CfnBucket.LoggingConfigurationProperty value) Settings that define where logs are stored. -
getMetricsConfigurations
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket. -
setMetricsConfigurations
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket. -
setMetricsConfigurations
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket. -
getNotificationConfiguration
Configuration that defines how Amazon S3 handles bucket notifications. -
setNotificationConfiguration
Configuration that defines how Amazon S3 handles bucket notifications. -
setNotificationConfiguration
@Stability(Stable) public void setNotificationConfiguration(@Nullable CfnBucket.NotificationConfigurationProperty value) Configuration that defines how Amazon S3 handles bucket notifications. -
getObjectLockConfiguration
This operation is not supported by directory buckets.
-
setObjectLockConfiguration
This operation is not supported by directory buckets.
-
setObjectLockConfiguration
@Stability(Stable) public void setObjectLockConfiguration(@Nullable CfnBucket.ObjectLockConfigurationProperty value) This operation is not supported by directory buckets.
-
getObjectLockEnabled
Indicates whether this bucket has an Object Lock configuration enabled. -
setObjectLockEnabled
Indicates whether this bucket has an Object Lock configuration enabled. -
setObjectLockEnabled
Indicates whether this bucket has an Object Lock configuration enabled. -
getOwnershipControls
Configuration that defines how Amazon S3 handles Object Ownership rules. -
setOwnershipControls
Configuration that defines how Amazon S3 handles Object Ownership rules. -
setOwnershipControls
@Stability(Stable) public void setOwnershipControls(@Nullable CfnBucket.OwnershipControlsProperty value) Configuration that defines how Amazon S3 handles Object Ownership rules. -
getPublicAccessBlockConfiguration
Configuration that defines how Amazon S3 handles public access. -
setPublicAccessBlockConfiguration
Configuration that defines how Amazon S3 handles public access. -
setPublicAccessBlockConfiguration
@Stability(Stable) public void setPublicAccessBlockConfiguration(@Nullable CfnBucket.PublicAccessBlockConfigurationProperty value) Configuration that defines how Amazon S3 handles public access. -
getReplicationConfiguration
Configuration for replicating objects in an S3 bucket. -
setReplicationConfiguration
Configuration for replicating objects in an S3 bucket. -
setReplicationConfiguration
@Stability(Stable) public void setReplicationConfiguration(@Nullable CfnBucket.ReplicationConfigurationProperty value) Configuration for replicating objects in an S3 bucket. -
getTagsRaw
An arbitrary set of tags (key-value pairs) for this S3 bucket. -
setTagsRaw
An arbitrary set of tags (key-value pairs) for this S3 bucket. -
getVersioningConfiguration
Enables multiple versions of all objects in this bucket. -
setVersioningConfiguration
Enables multiple versions of all objects in this bucket. -
setVersioningConfiguration
@Stability(Stable) public void setVersioningConfiguration(@Nullable CfnBucket.VersioningConfigurationProperty value) Enables multiple versions of all objects in this bucket. -
getWebsiteConfiguration
Information used to configure the bucket as a static website. -
setWebsiteConfiguration
Information used to configure the bucket as a static website. -
setWebsiteConfiguration
@Stability(Stable) public void setWebsiteConfiguration(@Nullable CfnBucket.WebsiteConfigurationProperty value) Information used to configure the bucket as a static website.
-