Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update s3 bucket physical names to use amazon owned s3 buckets #31576

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7484,10 +7484,10 @@ const bucket = new s3.Bucket(this, 'L2Bucket');
const bucketResource = bucket.findChild('Resource') as s3.cloudformation.BucketResource;

// strongly-typed overrides
bucketResource.propertyOverrides.bucketName = 'NewBucketName';
bucketResource.propertyOverrides.bucketName = 'amzn-s3-demo-bucket';

// weakly-typed overrides
bucketResource.addPropertyOverride('BucketName', 'NewerBucketName');
bucketResource.addPropertyOverride('BucketName', 'amzn-s3-demo-bucket1');
```

### Bug Fixes
Expand Down Expand Up @@ -8289,7 +8289,7 @@ new Pipeline(this, 'MyCoolPipeline', { artifactsBucket: bucket });
You can also import a bucket by just specifying its name:

```typescript
const bucket = Bucket.import({ bucketName: new BucketName('my-bucket') });
const bucket = Bucket.import({ bucketName: new BucketName('amzn-s3-demo-bucket') });
new Pipeline(this, 'MyCoolPipeline', { artifactsBucket: bucket });
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const service1 = namespace.createService('NonIpService', {
});

service1.registerNonIpInstance('NonIpInstance', {
customAttributes: { arn: 'arn:aws:s3:::mybucket' },
customAttributes: { arn: 'arn:aws:s3:::amzn-s3-demo-bucket' },
});

const service2 = namespace.createService('IpService', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-staging-synthesizer-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class CustomStagingStack extends Stack implements IStagingResources {

public addFile(asset: FileAssetSource): FileStagingLocation {
return {
bucketName: 'myBucket',
bucketName: 'amzn-s3-demo-bucket',
assumeRoleArn: 'myArn',
dependencyStack: this,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codestar-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ new codestar.GitHubRepository(this, 'GitHubRepo', {
accessToken: SecretValue.secretsManager('my-github-token', {
jsonField: 'token',
}),
contentsBucket: s3.Bucket.fromBucketName(this, 'Bucket', 'bucket-name'),
contentsBucket: s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket'),
contentsKey: 'import.zip',
});
```
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-redshift-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as s3 from 'aws-cdk-lib/aws-s3';

const vpc = new ec2.Vpc(this, 'Vpc');
const bucket = s3.Bucket.fromBucketName(this, 'bucket', 'logging-bucket');
const bucket = s3.Bucket.fromBucketName(this, 'bucket', 'amzn-s3-demo-bucket');

const cluster = new Cluster(this, 'Redshift', {
masterUser: {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/integ-tests-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,11 @@ need to do is add a dependency between the calls. There is an helper method `nex
declare const integ: IntegTest;

integ.assertions.awsApiCall('S3', 'putObject', {
Bucket: 'my-bucket',
Bucket: 'amzn-s3-demo-bucket',
Key: 'my-key',
Body: 'helloWorld',
}).next(integ.assertions.awsApiCall('S3', 'getObject', {
Bucket: 'my-bucket',
Bucket: 'amzn-s3-demo-bucket',
Key: 'my-key',
}));
```
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk-lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ a stack with a synthesizer, pass it as one of its properties:
```ts
new MyStack(app, 'MyStack', {
synthesizer: new DefaultStackSynthesizer({
fileAssetsBucketName: 'my-orgs-asset-bucket',
fileAssetsBucketName: 'amzn-s3-demo-bucket',
}),
});
```
Expand Down Expand Up @@ -1173,7 +1173,7 @@ The `CfnResource` class allows emitting arbitrary entries in the
new CfnResource(this, 'ResourceId', {
type: 'AWS::S3::Bucket',
properties: {
BucketName: 'bucket-name'
BucketName: 'amzn-s3-demo-bucket'
},
});
```
Expand All @@ -1197,7 +1197,7 @@ new CfnInclude(this, 'ID', {
Bucket: {
Type: 'AWS::S3::Bucket',
Properties: {
BucketName: 'my-shiny-bucket'
BucketName: 'amzn-s3-demo-bucket'
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-cloudfront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1124,15 +1124,15 @@ new cloudfront.CloudFrontWebDistribution(this, 'ADistribution', {
originConfigs: [
{
s3OriginSource: {
s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucket', 'myoriginbucket'),
s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucket', 'amzn-s3-demo-bucket'),
originPath: '/',
originHeaders: {
'myHeader': '42',
},
originShieldRegion: 'us-west-2',
},
failoverS3OriginSource: {
s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucketFallback', 'myoriginbucketfallback'),
s3BucketSource: s3.Bucket.fromBucketName(this, 'aBucketFallback', 'amzn-s3-demo-bucket1'),
originPath: '/somewhere',
originHeaders: {
'myHeader2': '21',
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/aws-cloudtrail/SAMPLE-EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ PutObject
"eventSource": "s3.amazonaws.com",
"resources": [
{
"ARN": "arn:aws:s3:::BUCKETNAME/OBJECTKEY",
"ARN": "arn:aws:s3:::amzn-s3-demo-bucket/OBJECTKEY",
"type": "AWS::S3::Object"
},
{
"accountId": "123456789012",
"ARN": "arn:aws:s3:::BUCKETNAME",
"ARN": "arn:aws:s3:::amzn-s3-demo-bucket",
"type": "AWS::S3::Bucket"
}
],
Expand Down Expand Up @@ -61,8 +61,8 @@ PutObject
},
"responseElements": null,
"requestParameters": {
"bucketName": "BUCKETNAME",
"Host": "BUCKETNAME.s3.eu-west-1.amazonaws.com",
"bucketName": "amzn-s3-demo-bucket",
"Host": "amzn-s3-demo-bucket.s3.eu-west-1.amazonaws.com",
"key": "OBJECTKEY"
}
}
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-codebuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ new codebuild.Project(this, 'Project', {
buildImage: codebuild.WindowsBuildImage.fromEcrRepository(ecrRepository, 'v1.0', codebuild.WindowsImageType.SERVER_2019),
// optional certificate to include in the build image
certificate: {
bucket: s3.Bucket.fromBucketName(this, 'Bucket', 'my-bucket'),
bucket: s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket'),
objectKey: 'path/to/cert.pem',
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-codepipeline-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ you can specify the region explicitly:

```ts
const sourceBucket = s3.Bucket.fromBucketAttributes(this, 'SourceBucket', {
bucketName: 'my-bucket',
bucketName: 'amzn-s3-demo-bucket',
region: 'ap-southeast-1',
});
```
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-codepipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ const pipeline = new codepipeline.Pipeline(this, 'MyFirstPipeline', {
crossRegionReplicationBuckets: {
// note that a physical name of the replication Bucket must be known at synthesis time
'us-west-1': s3.Bucket.fromBucketAttributes(this, 'UsWest1ReplicationBucket', {
bucketName: 'my-us-west-1-replication-bucket',
bucketName: 'amzn-s3-demo-bucket',
// optional KMS key
encryptionKey: kms.Key.fromKeyArn(this, 'UsWest1ReplicationKey',
'arn:aws:kms:us-west-1:123456789012:key/1234-5678-9012'
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-lambda-event-sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ and is not compliant with `S3EventSource`. If this is the case, please consider
import * as s3 from 'aws-cdk-lib/aws-s3';
import { S3EventSourceV2 } from 'aws-cdk-lib/aws-lambda-event-sources';

const bucket = s3.Bucket.fromBucketName(this, 'Bucket', 'bucket-name');
const bucket = s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket');
declare const fn: lambda.Function;

fn.addEventSource(new S3EventSourceV2(bucket, {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ resource policy.
```ts
declare const fn: lambda.Function;
const servicePrincipal = new iam.ServicePrincipal('my-service');
const sourceArn = 'arn:aws:s3:::my-bucket';
const sourceArn = 'arn:aws:s3:::amzn-s3-demo-bucket';
const sourceAccount = '111122223333';
const servicePrincipalWithConditions = servicePrincipal.withConditions({
ArnLike: {
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-s3-assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ to an S3 bucket during deployment.

* `s3BucketName` - the name of the assets S3 bucket.
* `s3ObjectKey` - the S3 object key of the asset file (whether it's a file or a zip archive)
* `s3ObjectUrl` - the S3 object URL of the asset (i.e. s3://mybucket/mykey.zip)
* `httpUrl` - the S3 HTTP URL of the asset (i.e. https://s3.us-east-1.amazonaws.com/mybucket/mykey.zip)
* `s3ObjectUrl` - the S3 object URL of the asset (i.e. s3://amzn-s3-demo-bucket/mykey.zip)
* `httpUrl` - the S3 HTTP URL of the asset (i.e. https://s3.us-east-1.amazonaws.com/amzn-s3-demo-bucket/mykey.zip)

In the following example, the various asset attributes are exported as stack outputs:

Expand Down
36 changes: 18 additions & 18 deletions packages/aws-cdk-lib/aws-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ const bucket = new s3.Bucket(this, 'MyFirstBucket');

`Bucket` constructs expose the following deploy-time attributes:

- `bucketArn` - the ARN of the bucket (i.e. `arn:aws:s3:::bucket_name`)
- `bucketName` - the name of the bucket (i.e. `bucket_name`)
- `bucketArn` - the ARN of the bucket (i.e. `arn:aws:s3:::amzn-s3-demo-bucket`)
- `bucketName` - the name of the bucket (i.e. `amzn-s3-demo-bucket`)
- `bucketWebsiteUrl` - the Website URL of the bucket (i.e.
`http://bucket_name.s3-website-us-west-1.amazonaws.com`)
- `bucketDomainName` - the URL of the bucket (i.e. `bucket_name.s3.amazonaws.com`)
`http://amzn-s3-demo-bucket.s3-website-us-west-1.amazonaws.com`)
- `bucketDomainName` - the URL of the bucket (i.e. `amzn-s3-demo-bucket.s3.amazonaws.com`)
- `bucketDualStackDomainName` - the dual-stack URL of the bucket (i.e.
`bucket_name.s3.dualstack.eu-west-1.amazonaws.com`)
`amzn-s3-demo-bucket.s3.dualstack.eu-west-1.amazonaws.com`)
- `bucketRegionalDomainName` - the regional URL of the bucket (i.e.
`bucket_name.s3.eu-west-1.amazonaws.com`)
`amzn-s3-demo-bucket.s3.eu-west-1.amazonaws.com`)
- `arnForObjects(pattern)` - the ARN of an object or objects within the bucket (i.e.
`arn:aws:s3:::bucket_name/exampleobject.png` or
`arn:aws:s3:::bucket_name/Development/*`)
`arn:aws:s3:::amzn-s3-demo-bucket/exampleobject.png` or
`arn:aws:s3:::amzn-s3-demo-bucket/Development/*`)
- `urlForObject(key)` - the HTTP URL of an object within the bucket (i.e.
`https://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey`)
- `virtualHostedUrlForObject(key)` - the virtual-hosted style HTTP URL of an object
Expand Down Expand Up @@ -103,7 +103,7 @@ If you try to add a policy statement to an existing bucket, this method will
not do anything:

```ts
const bucket = s3.Bucket.fromBucketName(this, 'existingBucket', 'bucket-name');
const bucket = s3.Bucket.fromBucketName(this, 'existingBucket', 'amzn-s3-demo-bucket');

// No policy statement will be added to the resource
const result = bucket.addToResourcePolicy(
Expand Down Expand Up @@ -232,7 +232,7 @@ are not allowed in the bucket name.
```ts
declare const myLambda: lambda.Function;
const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', {
bucketArn: 'arn:aws:s3:::my-bucket',
bucketArn: 'arn:aws:s3:::amzn-s3-demo-bucket',
});

// now you can just call methods on the bucket
Expand All @@ -246,19 +246,19 @@ Alternatively, short-hand factories are available as `Bucket.fromBucketName` and
name or ARN respectively:

```ts
const byName = s3.Bucket.fromBucketName(this, 'BucketByName', 'my-bucket');
const byArn = s3.Bucket.fromBucketArn(this, 'BucketByArn', 'arn:aws:s3:::my-bucket');
const byName = s3.Bucket.fromBucketName(this, 'BucketByName', 'amzn-s3-demo-bucket');
const byArn = s3.Bucket.fromBucketArn(this, 'BucketByArn', 'arn:aws:s3:::amzn-s3-demo-bucket');
```

The bucket's region defaults to the current stack's region, but can also be explicitly set in cases where one of the bucket's
regional properties needs to contain the correct values.

```ts
const myCrossRegionBucket = s3.Bucket.fromBucketAttributes(this, 'CrossRegionImport', {
bucketArn: 'arn:aws:s3:::my-bucket',
bucketArn: 'arn:aws:s3:::amzn-s3-demo-bucket',
region: 'us-east-1',
});
// myCrossRegionBucket.bucketRegionalDomainName === 'my-bucket.s3.us-east-1.amazonaws.com'
// myCrossRegionBucket.bucketRegionalDomainName === 'amzn-s3-demo-bucket.s3.us-east-1.amazonaws.com'
```

## Bucket Notifications
Expand Down Expand Up @@ -302,7 +302,7 @@ Adding notifications on existing buckets:
```ts
declare const topic: sns.Topic;
const bucket = s3.Bucket.fromBucketAttributes(this, 'ImportedBucket', {
bucketArn: 'arn:aws:s3:::my-bucket',
bucketArn: 'arn:aws:s3:::amzn-s3-demo-bucket',
});
bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.SnsDestination(topic));
```
Expand Down Expand Up @@ -500,7 +500,7 @@ policy resource using the L1 Construct. Although the mixing of L1 and L2 Constru
recommended, there are no mechanisms in place to prevent users from doing this at the moment.

```ts
const bucketName = "my-favorite-bucket-name";
const bucketName = "amzn-s3-demo-bucket";
const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket', {
objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
bucketName,
Expand Down Expand Up @@ -566,7 +566,7 @@ Alternatively, users can use the L2 Bucket Policy Construct
`BucketPolicy.fromCfnBucketPolicy` to wrap around `CfnBucketPolicy` Construct. This will allow the subsequent bucket policy generated by `serverAccessLogsBucket` usage to append to the existing bucket policy instead of overwriting.

```ts
const bucketName = "my-favorite-bucket-name";
const bucketName = "amzn-s3-demo-bucket";
const accessLogsBucket = new s3.Bucket(this, 'AccessLogsBucket', {
objectOwnership: s3.ObjectOwnership.BUCKET_OWNER_ENFORCED,
bucketName,
Expand Down Expand Up @@ -645,7 +645,7 @@ However, if you use an imported bucket (i.e `Bucket.fromXXX()`), you'll have to
"Effect": "Allow",
"Principal": { "Service": "s3.amazonaws.com" },
"Action": "s3:PutObject",
"Resource": ["arn:aws:s3:::destinationBucket/*"]
"Resource": ["arn:aws:s3:::amzn-s3-demo-destination-bucket/*"]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-servicecatalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class LambdaProduct extends servicecatalog.ProductStack {
}

const userDefinedBucket = new Bucket(this, `UserDefinedBucket`, {
bucketName: 'user-defined-bucket-for-product-stack-assets',
bucketName: 'amzn-s3-demo-bucket',
});

const product = new servicecatalog.CloudFormationProduct(this, 'Product', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const service1 = namespace.createService('NonIpService', {
});

service1.registerNonIpInstance('NonIpInstance', {
customAttributes: { arn: 'arn:aws:s3:::mybucket' },
customAttributes: { arn: 'arn:aws:s3:::amzn-s3-demo-bucket' },
});

const service2 = namespace.createService('IpService', {
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk-lib/aws-stepfunctions-tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const detectLabels = new tasks.CallAwsService(this, 'DetectLabels', {
additionalIamStatements: [
new iam.PolicyStatement({
actions: ['s3:getObject'],
resources: ['arn:aws:s3:::my-bucket/*'],
resources: ['arn:aws:s3:::amzn-s3-demo-bucket/*'],
}),
],
});
Expand Down Expand Up @@ -284,7 +284,7 @@ const startQueryExecutionJob = new tasks.AthenaStartQueryExecution(this, 'Start
encryptionOption: tasks.EncryptionOption.S3_MANAGED,
},
outputLocation: {
bucketName: 'query-results-bucket',
bucketName: 'amzn-s3-demo-bucket',
objectKey: 'folder',
},
},
Expand Down Expand Up @@ -1593,7 +1593,7 @@ new tasks.SageMakerCreateTrainingJob(this, 'TrainSagemaker', {
},
}],
outputDataConfig: {
s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'mybucket'), 'myoutputpath'),
s3OutputLocation: tasks.S3Location.fromBucket(s3.Bucket.fromBucketName(this, 'Bucket', 'amzn-s3-demo-bucket'), 'myoutputpath'),
},
resourceConfig: {
instanceCount: 1,
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/cloudformation-include/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It could be in JSON format, in a file `my-template.json`:
"Bucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "some-bucket-name"
"BucketName": "amzn-s3-demo-bucket"
}
}
}
Expand All @@ -32,7 +32,7 @@ Resources:
Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: some-bucket-name
BucketName: amzn-s3-demo-bucket
```

It can be included in a CDK application with the following code:
Expand Down Expand Up @@ -85,7 +85,7 @@ for example, the name of the bucket can be changed:
```ts
declare const cfnTemplate: cfn_inc.CfnInclude;
const cfnBucket = cfnTemplate.getResource('Bucket') as s3.CfnBucket;
cfnBucket.bucketName = 'my-bucket-name';
cfnBucket.bucketName = 'amzn-s3-demo-bucket';
```

You can also refer to the resource when defining other constructs,
Expand Down Expand Up @@ -410,7 +410,7 @@ and modify them like any other included template:
declare const childTemplate: cfn_inc.CfnInclude;

const cfnBucket = childTemplate.getResource('MyBucket') as s3.CfnBucket;
cfnBucket.bucketName = 'my-new-bucket-name';
cfnBucket.bucketName = 'amzn-s3-demo-bucket1';

const role = new iam.Role(this, 'MyRole', {
assumedBy: new iam.AccountRootPrincipal(),
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ The `CfnResource` class allows emitting arbitrary entries in the
new CfnResource(this, 'ResourceId', {
type: 'AWS::S3::Bucket',
properties: {
BucketName: 'bucket-name'
BucketName: 'amzn-s3-demo-bucket'
},
});
```
Expand Down
Loading
Loading