# BucketAttributes

A reference to a bucket outside this stack.

- Source: [`aws-s3/lib/bucket.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L438)
- Type last changed: v2.64.0 · 9 Feb 2023

## Example

```ts
// Deploy an imported S3 bucket from a different account
declare const stage: codepipeline.IStage;
declare const input: codepipeline.Artifact;
stage.addAction(new codepipeline_actions.S3DeployAction({
  bucket: s3.Bucket.fromBucketAttributes(this, 'Bucket', {
    account: '123456789012',
    // ...
  }),
  input: input,
  actionName: 's3-deploy-action',
  // ...
}));
```

## Properties

- `account`: string — 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

- `bucketArn`: string — The ARN of the bucket.

  At least one of bucketArn or bucketName must be
  defined in order to initialize a bucket ref.

- `bucketDomainName`: string — The domain name of the bucket.

  **Default:** Inferred from bucket name

- `bucketDualStackDomainName`: string — The IPv6 DNS name of the specified bucket.

- `bucketName`: string — 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`: string — The regional domain name of the specified bucket.

- `bucketWebsiteNewUrlFormat`: boolean — The correct website url format can be inferred automatically from the bucket `region`. Always provide the bucket region if the `bucketWebsiteUrl` will be used. Alternatively provide the full `bucketWebsiteUrl` manually.

  **Default:** inferred from available region information, `false` otherwise

  This should be true for
  regions launched since 2014.

- `bucketWebsiteUrl`: string — The website URL of the bucket (if static web hosting is enabled).

  **Default:** Inferred from bucket name and region

- `encryptionKey`: [IKey](/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — KMS encryption key associated with this bucket.

  **Default:** no encryption key

- `isWebsite`: boolean = false — If this bucket has been configured for static website hosting.

- `notificationsHandlerRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The role to be used by the notifications handler.

  **Default:** a new role will be created.

- `region`: string — 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

  Features that require the region (e.g. `bucketWebsiteUrl`) won't fully work
  if the region cannot be correctly inferred.
