interface BucketAttributes
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.S3.BucketAttributes |
Java | software.amazon.awscdk.services.s3.BucketAttributes |
Python | aws_cdk.aws_s3.BucketAttributes |
TypeScript (source) | @aws-cdk/aws-s3 » BucketAttributes |
A reference to a bucket outside this stack.
Example
declare const myLambda: lambda.Function;
const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', {
bucketArn: 'arn:aws:s3:::my-bucket',
});
// now you can just call methods on the bucket
bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(myLambda), {prefix: 'home/myusername/*'});
Properties
Name | Type | Description |
---|---|---|
account? | string | The account this existing bucket belongs to. |
bucket | string | The ARN of the bucket. |
bucket | string | The domain name of the bucket. |
bucket | string | The IPv6 DNS name of the specified bucket. |
bucket | string | The name of the bucket. |
bucket | string | The regional domain name of the specified bucket. |
bucket | boolean | The format of the website URL of the bucket. |
bucket | string | The website URL of the bucket (if static web hosting is enabled). |
encryption | IKey | |
is | boolean | If this bucket has been configured for static website hosting. |
notifications | IRole | The role to be used by the notifications handler. |
region? | string | The region this existing bucket is in. |
account?
Type:
string
(optional, default: it's assumed the bucket belongs to the same account as the scope it's being imported into)
The account this existing bucket belongs to.
bucketArn?
Type:
string
(optional)
The ARN of the bucket.
At least one of bucketArn or bucketName must be defined in order to initialize a bucket ref.
bucketDomainName?
Type:
string
(optional, default: Inferred from bucket name)
The domain name of the bucket.
bucketDualStackDomainName?
Type:
string
(optional)
The IPv6 DNS name of the specified bucket.
bucketName?
Type:
string
(optional)
The name of the bucket.
If the underlying value of ARN is a string, the name will be parsed from the ARN. Otherwise, the name is optional, but some features that require the bucket name such as auto-creating a bucket policy, won't work.
bucketRegionalDomainName?
Type:
string
(optional)
The regional domain name of the specified bucket.
bucketWebsiteNewUrlFormat?
Type:
boolean
(optional, default: false)
The format of the website URL of the bucket.
This should be true for regions launched since 2014.
bucketWebsiteUrl?
Type:
string
(optional, default: Inferred from bucket name)
The website URL of the bucket (if static web hosting is enabled).
encryptionKey?
Type:
IKey
(optional)
isWebsite?
Type:
boolean
(optional, default: false)
If this bucket has been configured for static website hosting.
notificationsHandlerRole?
Type:
IRole
(optional, default: a new role will be created.)
The role to be used by the notifications handler.
region?
Type:
string
(optional, default: it's assumed the bucket is in the same region as the scope it's being imported into)
The region this existing bucket is in.