cloudfront: How to migrate CloudFrontWebDistribution to the new Distribution class
See original GitHub issue❓ General Issue
Please consider the following code:
new cloudfront.CloudFrontWebDistribution(this, 'CFDistribution', {
// ...
});
I converted this into the new Distribution class.
new cloudfront.Distribution(this, 'CFDistribution', {
// ...
});
When I deployed this new code I got the following error:
One or more of the CNAMEs you provided are already associated with a different resource. (Service: AmazonCloudFront; Status Code: 409; Error Code: CNAMEAlreadyExists;
This is because the deployment tried to create a new CloudFront distribution instead of reusing the old one.
The Question
How could I make CDK reuse the old Cloudfront distribution? Would an override of the LogicalID help here? If yes then how can it be done?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:9 (2 by maintainers)
Top Results From Across the Web
class CloudFrontWebDistribution (construct) · AWS CDK
Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution. To specify a web ACL created using the...
Read more >How to migrate from one cloudfront distribution to another
Create the new distribution with the correct certificate but no Alternate Domain Name, and allow it to stabilize. Change the DNS for the...
Read more >CloudFront — Boto3 Docs 1.26.35 documentation
With this operation you can move an alias that's already in use on a CloudFront distribution to a different distribution in one step....
Read more >aws-cdk.aws-cloudfront - PyPI
CloudFront distributions deliver your content from one or more origins; an origin is the ... Replace new CloudFrontWebDistribution with new Distribution .
Read more >AWS AMER Summit Aug 2021: Migrating content ... - YouTube
In this session, learn how to migrate your content delivery ... AMER Summit Aug 2021: Migrating content distribution to Amazon CloudFront : ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FWIW, the following change works for me.
where the logicalId comes from my existing stack. Check
cdk diff
to make sure the distribution is reused.I can’t see that being scalable or possible when you have hundreds of environments being deployed.