BucketAttributes
- class aws_cdk.aws_s3.BucketAttributes(*, account=None, bucket_arn=None, bucket_domain_name=None, bucket_dual_stack_domain_name=None, bucket_name=None, bucket_regional_domain_name=None, bucket_website_new_url_format=None, bucket_website_url=None, encryption_key=None, is_website=None, notifications_handler_role=None, region=None)
Bases:
object
A reference to a bucket outside this stack.
- Parameters:
account (
Optional
[str
]) – The account this existing bucket belongs to. Default: - it’s assumed the bucket belongs to the same account as the scope it’s being imported intobucket_arn (
Optional
[str
]) – The ARN of the bucket. At least one of bucketArn or bucketName must be defined in order to initialize a bucket ref.bucket_domain_name (
Optional
[str
]) – The domain name of the bucket. Default: Inferred from bucket namebucket_dual_stack_domain_name (
Optional
[str
]) – The IPv6 DNS name of the specified bucket.bucket_name (
Optional
[str
]) – 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.bucket_regional_domain_name (
Optional
[str
]) – The regional domain name of the specified bucket.bucket_website_new_url_format (
Optional
[bool
]) – The format of the website URL of the bucket. This should be true for regions launched since 2014. Default: falsebucket_website_url (
Optional
[str
]) – The website URL of the bucket (if static web hosting is enabled). Default: Inferred from bucket nameencryption_key (
Optional
[IKey
]) –is_website (
Optional
[bool
]) – If this bucket has been configured for static website hosting. Default: falsenotifications_handler_role (
Optional
[IRole
]) – The role to be used by the notifications handler. Default: - a new role will be created.region (
Optional
[str
]) – The region this existing bucket is in. Default: - it’s assumed the bucket is in the same region as the scope it’s being imported into
- ExampleMetadata:
infused
Example:
# my_lambda: lambda.Function bucket = s3.Bucket.from_bucket_attributes(self, "ImportedBucket", bucket_arn="arn:aws:s3:::my-bucket" ) # now you can just call methods on the bucket bucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.LambdaDestination(my_lambda), prefix="home/myusername/*")
Attributes
- account
The account this existing bucket belongs to.
- Default:
it’s assumed the bucket belongs to the same account as the scope it’s being imported into
- bucket_arn
The ARN of the bucket.
At least one of bucketArn or bucketName must be defined in order to initialize a bucket ref.
- bucket_domain_name
The domain name of the bucket.
- Default:
Inferred from bucket name
- bucket_dual_stack_domain_name
The IPv6 DNS name of the specified bucket.
- bucket_name
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.
- bucket_regional_domain_name
The regional domain name of the specified bucket.
- bucket_website_new_url_format
The format of the website URL of the bucket.
This should be true for regions launched since 2014.
- Default:
false
- bucket_website_url
The website URL of the bucket (if static web hosting is enabled).
- Default:
Inferred from bucket name
- encryption_key
- is_website
If this bucket has been configured for static website hosting.
- Default:
false
- notifications_handler_role
The role to be used by the notifications handler.
- Default:
a new role will be created.
- region
The region this existing bucket is in.
- Default:
it’s assumed the bucket is in the same region as the scope it’s being imported into