Class CfnBucket
The AWS::S3::Bucket resource creates an Amazon S3 bucket in the same AWS Region where you create the AWS CloudFormation stack.
Inherited Members
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnBucket : CfnResource, IInspectable, IBucketRef, IConstruct, IDependable, IEnvironmentAware, ITaggable
Syntax (vb)
Public Class CfnBucket Inherits CfnResource Implements IInspectable, IBucketRef, IConstruct, IDependable, IEnvironmentAware, ITaggable
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
Examples
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 }
}));
Synopsis
Constructors
| CfnBucket(Construct, string, ICfnBucketProps?) | Create a new |
Properties
| AbacStatus | The ABAC status of the general purpose bucket. |
| AccelerateConfiguration | Configures the transfer acceleration state for an Amazon S3 bucket. |
| AccessControl | This is a legacy property, and it is not recommended for most use cases. |
| AnalyticsConfigurations | Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket. |
| AttrArn | Returns the Amazon Resource Name (ARN) of the specified bucket. |
| AttrDomainName | Returns the IPv4 DNS name of the specified bucket. |
| AttrDualStackDomainName | Returns the IPv6 DNS name of the specified bucket. |
| AttrMetadataConfigurationDestination | The destination information for the S3 Metadata configuration. |
| AttrMetadataConfigurationInventoryTableConfigurationTableArn | The Amazon Resource Name (ARN) for the inventory table. |
| AttrMetadataConfigurationInventoryTableConfigurationTableName | The name of the inventory table. |
| AttrMetadataConfigurationJournalTableConfigurationTableArn | The Amazon Resource Name (ARN) for the journal table. |
| AttrMetadataConfigurationJournalTableConfigurationTableName | The name of the journal table. |
| AttrMetadataTableConfigurationS3TablesDestinationTableArn | The Amazon Resource Name (ARN) for the metadata table in the metadata table configuration. |
| AttrMetadataTableConfigurationS3TablesDestinationTableNamespace | The table bucket namespace for the metadata table in your metadata table configuration. |
| AttrRegionalDomainName | Returns the regional domain name of the specified bucket. |
| AttrWebsiteUrl | Returns the Amazon S3 website endpoint for the specified bucket. |
| BucketEncryption | 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). |
| BucketName | A name for the bucket. |
| BucketRef | A reference to a Bucket resource. |
| CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
| CfnProperties | The |
| CorsConfiguration | Describes the cross-origin access configuration for objects in an Amazon S3 bucket. |
| IntelligentTieringConfigurations | Defines how Amazon S3 handles Intelligent-Tiering storage. |
| InventoryConfigurations | Specifies the S3 Inventory configuration for an Amazon S3 bucket. |
| LifecycleConfiguration | Specifies the lifecycle configuration for objects in an Amazon S3 bucket. |
| LoggingConfiguration | Settings that define where logs are stored. |
| MetadataConfiguration | The S3 Metadata configuration for a general purpose bucket. |
| MetadataTableConfiguration | The metadata table configuration of an Amazon S3 general purpose bucket. |
| MetricsConfigurations | Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket. |
| NotificationConfiguration | Configuration that defines how Amazon S3 handles bucket notifications. |
| ObjectLockConfiguration | This operation is not supported for directory buckets. |
| ObjectLockEnabled | Indicates whether this bucket has an Object Lock configuration enabled. |
| OwnershipControls | Configuration that defines how Amazon S3 handles Object Ownership rules. |
| PublicAccessBlockConfiguration | Configuration that defines how Amazon S3 handles public access. |
| ReplicationConfiguration | Configuration for replicating objects in an S3 bucket. |
| Tags | Tag Manager which manages the tags for this resource. |
| TagsRaw | An arbitrary set of tags (key-value pairs) for this S3 bucket. |
| VersioningConfiguration | Enables multiple versions of all objects in this bucket. |
| WebsiteConfiguration | Information used to configure the bucket as a static website. |
Methods
| ArnForBucket(IBucketRef) | The |
| FromBucketArn(Construct, string, string) | Creates a new IBucketRef from an ARN. |
| FromBucketName(Construct, string, string) | Creates a new IBucketRef from a bucketName. |
| Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
| IsCfnBucket(object) | Checks whether the given object is a CfnBucket. |
| RenderProperties(IDictionary<string, object>) | The |
Constructors
CfnBucket(Construct, string, ICfnBucketProps?)
Create a new AWS::S3::Bucket.
public CfnBucket(Construct scope, string id, ICfnBucketProps? props = null)
Parameters
- scope Construct
Scope in which this resource is defined.
- id string
Construct identifier for this resource (unique in its scope).
- props ICfnBucketProps
Resource properties.
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
Properties
AbacStatus
The ABAC status of the general purpose bucket.
public virtual string? AbacStatus { get; set; }
Property Value
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
AccelerateConfiguration
Configures the transfer acceleration state for an Amazon S3 bucket.
public virtual object? AccelerateConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IAccelerateConfigurationProperty
AccessControl
This is a legacy property, and it is not recommended for most use cases.
public virtual string? AccessControl { get; set; }
Property Value
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
AnalyticsConfigurations
Specifies the configuration and any analyses for the analytics filter of an Amazon S3 bucket.
public virtual object? AnalyticsConfigurations { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnBucket.IAnalyticsConfigurationProperty)[]
AttrArn
Returns the Amazon Resource Name (ARN) of the specified bucket.
public virtual string AttrArn { get; }
Property Value
Remarks
Example: arn:aws:s3:::DOC-EXAMPLE-BUCKET
CloudformationAttribute: Arn
AttrDomainName
Returns the IPv4 DNS name of the specified bucket.
public virtual string AttrDomainName { get; }
Property Value
Remarks
Example: DOC-EXAMPLE-BUCKET.s3.amazonaws.com
CloudformationAttribute: DomainName
AttrDualStackDomainName
Returns the IPv6 DNS name of the specified bucket.
public virtual string AttrDualStackDomainName { get; }
Property Value
Remarks
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 .
CloudformationAttribute: DualStackDomainName
AttrMetadataConfigurationDestination
The destination information for the S3 Metadata configuration.
public virtual IResolvable AttrMetadataConfigurationDestination { get; }
Property Value
Remarks
CloudformationAttribute: MetadataConfiguration.Destination
AttrMetadataConfigurationInventoryTableConfigurationTableArn
The Amazon Resource Name (ARN) for the inventory table.
public virtual string AttrMetadataConfigurationInventoryTableConfigurationTableArn { get; }
Property Value
Remarks
CloudformationAttribute: MetadataConfiguration.InventoryTableConfiguration.TableArn
AttrMetadataConfigurationInventoryTableConfigurationTableName
The name of the inventory table.
public virtual string AttrMetadataConfigurationInventoryTableConfigurationTableName { get; }
Property Value
Remarks
CloudformationAttribute: MetadataConfiguration.InventoryTableConfiguration.TableName
AttrMetadataConfigurationJournalTableConfigurationTableArn
The Amazon Resource Name (ARN) for the journal table.
public virtual string AttrMetadataConfigurationJournalTableConfigurationTableArn { get; }
Property Value
Remarks
CloudformationAttribute: MetadataConfiguration.JournalTableConfiguration.TableArn
AttrMetadataConfigurationJournalTableConfigurationTableName
The name of the journal table.
public virtual string AttrMetadataConfigurationJournalTableConfigurationTableName { get; }
Property Value
Remarks
CloudformationAttribute: MetadataConfiguration.JournalTableConfiguration.TableName
AttrMetadataTableConfigurationS3TablesDestinationTableArn
The Amazon Resource Name (ARN) for the metadata table in the metadata table configuration.
public virtual string AttrMetadataTableConfigurationS3TablesDestinationTableArn { get; }
Property Value
Remarks
The specified metadata table name must be unique within the aws_s3_metadata namespace in the destination table bucket.
CloudformationAttribute: MetadataTableConfiguration.S3TablesDestination.TableArn
AttrMetadataTableConfigurationS3TablesDestinationTableNamespace
The table bucket namespace for the metadata table in your metadata table configuration.
public virtual string AttrMetadataTableConfigurationS3TablesDestinationTableNamespace { get; }
Property Value
Remarks
This value is always aws_s3_metadata .
CloudformationAttribute: MetadataTableConfiguration.S3TablesDestination.TableNamespace
AttrRegionalDomainName
Returns the regional domain name of the specified bucket.
public virtual string AttrRegionalDomainName { get; }
Property Value
Remarks
Example: DOC-EXAMPLE-BUCKET.s3.us-east-2.amazonaws.com
CloudformationAttribute: RegionalDomainName
AttrWebsiteUrl
Returns the Amazon S3 website endpoint for the specified bucket.
public virtual string AttrWebsiteUrl { get; }
Property Value
Remarks
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
CloudformationAttribute: WebsiteURL
BucketEncryption
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).
public virtual object? BucketEncryption { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IBucketEncryptionProperty
BucketName
A name for the bucket.
public virtual string? BucketName { get; set; }
Property Value
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
BucketRef
A reference to a Bucket resource.
public virtual IBucketReference BucketRef { get; }
Property Value
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
CfnProperties
The AWS::S3::Bucket resource creates an Amazon S3 bucket in the same AWS Region where you create the AWS CloudFormation stack.
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
Overrides
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
CorsConfiguration
Describes the cross-origin access configuration for objects in an Amazon S3 bucket.
public virtual object? CorsConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.ICorsConfigurationProperty
IntelligentTieringConfigurations
Defines how Amazon S3 handles Intelligent-Tiering storage.
public virtual object? IntelligentTieringConfigurations { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnBucket.IIntelligentTieringConfigurationProperty)[]
InventoryConfigurations
Specifies the S3 Inventory configuration for an Amazon S3 bucket.
public virtual object? InventoryConfigurations { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnBucket.IInventoryConfigurationProperty)[]
LifecycleConfiguration
Specifies the lifecycle configuration for objects in an Amazon S3 bucket.
public virtual object? LifecycleConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.ILifecycleConfigurationProperty
LoggingConfiguration
Settings that define where logs are stored.
public virtual object? LoggingConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.ILoggingConfigurationProperty
MetadataConfiguration
The S3 Metadata configuration for a general purpose bucket.
public virtual object? MetadataConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IMetadataConfigurationProperty
MetadataTableConfiguration
The metadata table configuration of an Amazon S3 general purpose bucket.
public virtual object? MetadataTableConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IMetadataTableConfigurationProperty
MetricsConfigurations
Specifies a metrics configuration for the CloudWatch request metrics (specified by the metrics configuration ID) from an Amazon S3 bucket.
public virtual object? MetricsConfigurations { get; set; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnBucket.IMetricsConfigurationProperty)[]
NotificationConfiguration
Configuration that defines how Amazon S3 handles bucket notifications.
public virtual object? NotificationConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.INotificationConfigurationProperty
ObjectLockConfiguration
This operation is not supported for directory buckets.
public virtual object? ObjectLockConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IObjectLockConfigurationProperty
ObjectLockEnabled
Indicates whether this bucket has an Object Lock configuration enabled.
public virtual object? ObjectLockEnabled { get; set; }
Property Value
Remarks
Type union: either bool or IResolvable
OwnershipControls
Configuration that defines how Amazon S3 handles Object Ownership rules.
public virtual object? OwnershipControls { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IOwnershipControlsProperty
PublicAccessBlockConfiguration
Configuration that defines how Amazon S3 handles public access.
public virtual object? PublicAccessBlockConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IPublicAccessBlockConfigurationProperty
ReplicationConfiguration
Configuration for replicating objects in an S3 bucket.
public virtual object? ReplicationConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IReplicationConfigurationProperty
Tags
Tag Manager which manages the tags for this resource.
public virtual TagManager Tags { get; }
Property Value
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
TagsRaw
An arbitrary set of tags (key-value pairs) for this S3 bucket.
public virtual ICfnTag[]? TagsRaw { get; set; }
Property Value
ICfnTag[]
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
VersioningConfiguration
Enables multiple versions of all objects in this bucket.
public virtual object? VersioningConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IVersioningConfigurationProperty
WebsiteConfiguration
Information used to configure the bucket as a static website.
public virtual object? WebsiteConfiguration { get; set; }
Property Value
Remarks
Type union: either IResolvable or CfnBucket.IWebsiteConfigurationProperty
Methods
ArnForBucket(IBucketRef)
The AWS::S3::Bucket resource creates an Amazon S3 bucket in the same AWS Region where you create the AWS CloudFormation stack.
public static string ArnForBucket(IBucketRef resource)
Parameters
- resource IBucketRef
Returns
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
Examples
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 }
}));
FromBucketArn(Construct, string, string)
Creates a new IBucketRef from an ARN.
public static IBucketRef FromBucketArn(Construct scope, string id, string arn)
Parameters
Returns
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
FromBucketName(Construct, string, string)
Creates a new IBucketRef from a bucketName.
public static IBucketRef FromBucketName(Construct scope, string id, string bucketName)
Parameters
Returns
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
IsCfnBucket(object)
Checks whether the given object is a CfnBucket.
public static bool IsCfnBucket(object x)
Parameters
- x object
Returns
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused
RenderProperties(IDictionary<string, object>)
The AWS::S3::Bucket resource creates an Amazon S3 bucket in the same AWS Region where you create the AWS CloudFormation stack.
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props IDictionary<string, object>
Returns
Overrides
Remarks
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.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-s3-bucket.html
CloudformationResource: AWS::S3::Bucket
ExampleMetadata: infused