Skip to content

Commit

Permalink
docs(s3-deployment): cleanup (#13143)
Browse files Browse the repository at this point in the history
Cleanup based on #13136 (comment).

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
robertd authored Feb 21, 2021
1 parent c5e8b6d commit 354306a
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions packages/@aws-cdk/aws-s3-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,39 +156,15 @@ import * as origins from '@aws-cdk/aws-cloudfront-origins';

const bucket = new s3.Bucket(this, 'Destination');

// Option 1 (Stable): Handles buckets whether or not they are configured for website hosting.
// Handles buckets whether or not they are configured for website hosting.
const distribution = new cloudfront.Distribution(this, 'Distribution', {
defaultBehavior: { origin: new origins.S3Origin(bucket) },
});

// Option 2 (Stable): Use this if the bucket has website hosting enabled.
const distribution_for_website_bucket = new cloudfront.CloudFrontWebDistribution(this, 'DistributionForWebBucket', {
originConfigs: [
{
customOriginSource: {
domainName: bucket.bucketWebsiteDomainName,
},
behaviors : [ {isDefaultBehavior: true}]
}
]
});

// Option 3 (Stable): Use this version if the bucket does not have website hosting enabled.
const distribution_for_bucket = new cloudfront.CloudFrontWebDistribution(this, 'DistributionForBucket', {
originConfigs: [
{
s3OriginSource: {
s3BucketSource: bucket
},
behaviors : [ {isDefaultBehavior: true}]
}
]
});

new s3deploy.BucketDeployment(this, 'DeployWithInvalidation', {
sources: [s3deploy.Source.asset('./website-dist')],
destinationBucket: bucket,
distribution, // or distribution_for_website_bucket or distribution_for_bucket
distribution,
distributionPaths: ['/images/*.png'],
});
```
Expand Down

0 comments on commit 354306a

Please sign in to comment.