Interface IBucketProps
Namespace: Amazon.CDK.AWS.S3
Assembly: Amazon.CDK.AWS.S3.dll
Syntax (csharp)
public interface IBucketProps
Syntax (vb)
Public Interface IBucketProps
Remarks
ExampleMetadata: infused
Examples
var sourceBucket = new Bucket(this, "MyBucket", new BucketProps {
Versioned = true
});
var pipeline = new Pipeline(this, "MyPipeline");
var sourceOutput = new Artifact();
var sourceAction = new S3SourceAction(new S3SourceActionProps {
ActionName = "S3Source",
Bucket = sourceBucket,
BucketKey = "path/to/file.zip",
Output = sourceOutput
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { sourceAction }
});
Synopsis
Properties
AccessControl | Specifies a canned ACL that grants predefined permissions to the bucket. |
AutoDeleteObjects | Whether all objects should be automatically deleted when the bucket is removed from the stack or when the stack is deleted. |
BlockPublicAccess | The block public access configuration of this bucket. |
BucketKeyEnabled | Specifies whether Amazon S3 should use an S3 Bucket Key with server-side encryption using KMS (SSE-KMS) for new objects in the bucket. |
BucketName | Physical name of this bucket. |
Cors | The CORS configuration of this bucket. |
Encryption | The kind of server-side encryption to apply to this bucket. |
EncryptionKey | External KMS key to use for bucket encryption. |
EnforceSSL | Enforces SSL for requests. |
EventBridgeEnabled | Whether this bucket should send notifications to Amazon EventBridge or not. |
IntelligentTieringConfigurations | Inteligent Tiering Configurations. |
Inventories | The inventory configuration of the bucket. |
LifecycleRules | Rules that define how Amazon S3 manages objects during their lifetime. |
Metrics | The metrics configuration of this bucket. |
NotificationsHandlerRole | The role to be used by the notifications handler. |
ObjectOwnership | The objectOwnership of the bucket. |
PublicReadAccess | Grants public read access to all objects in the bucket. |
RemovalPolicy | Policy to apply when the bucket is removed from this stack. |
ServerAccessLogsBucket | Destination bucket for the server access logs. |
ServerAccessLogsPrefix | Optional log file prefix to use for the bucket's access logs. |
TransferAcceleration | Whether this bucket should have transfer acceleration turned on or not. |
Versioned | Whether this bucket should have versioning turned on or not. |
WebsiteErrorDocument | The name of the error document (e.g. "404.html") for the website. |
WebsiteIndexDocument | The name of the index document (e.g. "index.html") for the website. Enables static website hosting for this bucket. |
WebsiteRedirect | Specifies the redirect behavior of all requests to a website endpoint of a bucket. |
WebsiteRoutingRules | Rules that define when a redirect is applied and the redirect behavior. |
Properties
AccessControl
Specifies a canned ACL that grants predefined permissions to the bucket.
virtual Nullable<BucketAccessControl> AccessControl { get; }
Property Value
System.Nullable<BucketAccessControl>
Remarks
Default: BucketAccessControl.PRIVATE
AutoDeleteObjects
Whether all objects should be automatically deleted when the bucket is removed from the stack or when the stack is deleted.
virtual Nullable<bool> AutoDeleteObjects { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Requires the removalPolicy
to be set to RemovalPolicy.DESTROY
.
Warning if you have deployed a bucket with autoDeleteObjects: true
,
switching this to false
in a CDK version before 1.126.0
will lead to
all objects in the bucket being deleted. Be sure to update your bucket resources
by deploying with CDK version 1.126.0
or later before switching this value to false
.
Default: false
BlockPublicAccess
The block public access configuration of this bucket.
virtual BlockPublicAccess BlockPublicAccess { get; }
Property Value
Remarks
Default: - CloudFormation defaults will apply. New buckets and objects don't allow public access, but users can modify bucket policies or object permissions to allow public access
See: https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html
BucketKeyEnabled
Specifies whether Amazon S3 should use an S3 Bucket Key with server-side encryption using KMS (SSE-KMS) for new objects in the bucket.
virtual Nullable<bool> BucketKeyEnabled { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Only relevant, when Encryption is set to {@link BucketEncryption.KMS}
Default: - false
BucketName
Physical name of this bucket.
virtual string BucketName { get; }
Property Value
System.String
Remarks
Default: - Assigned by CloudFormation (recommended).
Cors
The CORS configuration of this bucket.
virtual ICorsRule[] Cors { get; }
Property Value
Remarks
Default: - No CORS configuration.
See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket-cors.html
Encryption
The kind of server-side encryption to apply to this bucket.
virtual Nullable<BucketEncryption> Encryption { get; }
Property Value
System.Nullable<BucketEncryption>
Remarks
If you choose KMS, you can specify a KMS key via encryptionKey
. If
encryption key is not specified, a key will automatically be created.
Default: - Kms
if encryptionKey
is specified, or Unencrypted
otherwise.
EncryptionKey
External KMS key to use for bucket encryption.
virtual IKey EncryptionKey { get; }
Property Value
Remarks
The 'encryption' property must be either not specified or set to "Kms". An error will be emitted if encryption is set to "Unencrypted" or "Managed".
Default: - If encryption is set to "Kms" and this property is undefined, a new KMS key will be created and associated with this bucket.
EnforceSSL
Enforces SSL for requests.
virtual Nullable<bool> EnforceSSL { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
S3.5 of the AWS Foundational Security Best Practices Regarding S3.
Default: false
See: https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-ssl-requests-only.html
EventBridgeEnabled
Whether this bucket should send notifications to Amazon EventBridge or not.
virtual Nullable<bool> EventBridgeEnabled { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
IntelligentTieringConfigurations
Inteligent Tiering Configurations.
virtual IIntelligentTieringConfiguration[] IntelligentTieringConfigurations { get; }
Property Value
IIntelligentTieringConfiguration[]
Remarks
Default: No Intelligent Tiiering Configurations.
See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/intelligent-tiering.html
Inventories
The inventory configuration of the bucket.
virtual IInventory[] Inventories { get; }
Property Value
Remarks
Default: - No inventory configuration
See: https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html
LifecycleRules
Rules that define how Amazon S3 manages objects during their lifetime.
virtual ILifecycleRule[] LifecycleRules { get; }
Property Value
Remarks
Default: - No lifecycle rules.
Metrics
The metrics configuration of this bucket.
virtual IBucketMetrics[] Metrics { get; }
Property Value
Remarks
Default: - No metrics configuration.
NotificationsHandlerRole
The role to be used by the notifications handler.
virtual IRole NotificationsHandlerRole { get; }
Property Value
Remarks
Default: - a new role will be created.
ObjectOwnership
The objectOwnership of the bucket.
virtual Nullable<ObjectOwnership> ObjectOwnership { get; }
Property Value
System.Nullable<ObjectOwnership>
Remarks
Default: - No ObjectOwnership configuration, uploading account will own the object.
See: https://docs.aws.amazon.com/AmazonS3/latest/dev/about-object-ownership.html
PublicReadAccess
Grants public read access to all objects in the bucket.
virtual Nullable<bool> PublicReadAccess { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Similar to calling bucket.grantPublicAccess()
Default: false
RemovalPolicy
Policy to apply when the bucket is removed from this stack.
virtual Nullable<RemovalPolicy> RemovalPolicy { get; }
Property Value
System.Nullable<RemovalPolicy>
Remarks
Default: - The bucket will be orphaned.
ServerAccessLogsBucket
Destination bucket for the server access logs.
virtual IBucket ServerAccessLogsBucket { get; }
Property Value
Remarks
Default: - If "serverAccessLogsPrefix" undefined - access logs disabled, otherwise - log to current bucket.
ServerAccessLogsPrefix
Optional log file prefix to use for the bucket's access logs.
virtual string ServerAccessLogsPrefix { get; }
Property Value
System.String
Remarks
If defined without "serverAccessLogsBucket", enables access logs to current bucket with this prefix.
Default: - No log file prefix
TransferAcceleration
Whether this bucket should have transfer acceleration turned on or not.
virtual Nullable<bool> TransferAcceleration { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Versioned
Whether this bucket should have versioning turned on or not.
virtual Nullable<bool> Versioned { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
WebsiteErrorDocument
The name of the error document (e.g. "404.html") for the website. websiteIndexDocument
must also be set if this is set.
virtual string WebsiteErrorDocument { get; }
Property Value
System.String
Remarks
Default: - No error document.
WebsiteIndexDocument
The name of the index document (e.g. "index.html") for the website. Enables static website hosting for this bucket.
virtual string WebsiteIndexDocument { get; }
Property Value
System.String
Remarks
Default: - No index document.
WebsiteRedirect
Specifies the redirect behavior of all requests to a website endpoint of a bucket.
virtual IRedirectTarget WebsiteRedirect { get; }
Property Value
Remarks
If you specify this property, you can't specify "websiteIndexDocument", "websiteErrorDocument" nor , "websiteRoutingRules".
Default: - No redirection.
WebsiteRoutingRules
Rules that define when a redirect is applied and the redirect behavior.
virtual IRoutingRule[] WebsiteRoutingRules { get; }
Property Value
Remarks
Default: - No redirection rules.