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(s3-deployment): cleanup #13143

Merged
merged 2 commits into from
Feb 21, 2021
Merged
Changes from 1 commit
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
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