question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(cloudfront): Migration from CloudFrontWebDistribution to WebDistribution

See original GitHub issue

General Issue

General Issue

The Question

I had the following code for CloudFrontWebDistribution

const webDistribution = new cloudfront.CloudFrontWebDistribution(this, 'MyCfnDistribution', {
    // ...
});

Converted it to support the Distribution Class

const webDistribution =new cloudfront.Distribution(this, 'MyCfnDistribution', {
    // ...
});
const distributionCfn = webDistribution.node.defaultChild as cloudfront.CfnDistribution;
distributionCfn.overrideLogicalId('LogicalId')

When I deployed this new code I got the following error:

Invalid request provided: The parameter globPattern is too small or empty. (Service: CloudFront, Status 
Code: 400

How Do I Solve this? Are there Any Other ways to Migrate to Distribution Construct?

CDK CLI Version

1.126.0

Framework Version

No response

Node.js Version

No response

OS

Windows

Language

Typescript

Language Version

No response

Other information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
peterwoodworthcommented, Dec 17, 2021

There doesn’t seem to be a direct way to not include the pathPattern, but you can override the CDK output for pathpattern on the additional behaviors with an escape hatch!

distributionCfn.addPropertyDeletionOverride('DistributionConfig.CacheBehaviors.0.PathPattern')

This will remove the PathPattern from your template for the first additional behavior you add. Simply change the number 0 to change which behavior you’re modifying in the template

0reactions
peterwoodworthcommented, Feb 1, 2022

Hey @DarshanAwachat, sorry I missed this

I’m not entirely sure what you’re asking here, but you shouldn’t run into any issues down the line just for overriding a logical ID. That should be stable 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

cloudfront: How to migrate CloudFrontWebDistribution to the ...
I converted this into the new Distribution class. new cloudfront. ... cloudfront: How to migrate CloudFrontWebDistribution to the new ...
Read more >
Routing traffic to an Amazon CloudFront distribution by using ...
Routing traffic to an Amazon CloudFront distribution by using your domain name · You can route traffic to a CloudFront distribution only for...
Read more >
Migrate a CDK managed CloudFormation distribution from the ...
I have an existing CDK setup in which a CloudFormation distribution is configured using the deprecated CloudFrontWebDistribution API, now I need ...
Read more >
AWS::CloudFront::Distribution DistributionConfig - 亚马逊云科技
CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection ...
Read more >
Web Distributions - Working with Amazon CloudFront Course
Now that we are familiar with the environment within which we will create our CloudFront web distribution, from the AWS Management Console select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found