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

CDK deploy: Cloudfront Distribution resources update fail with rate exceeded errors #29183

Closed
shaelm opened this issue Feb 20, 2024 · 6 comments
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@shaelm
Copy link

shaelm commented Feb 20, 2024

Describe the bug

Deploying multiple stacks each with their own cloudfront distribution, causes a deployment failure

in have tried in both 2.127.0, and 2.92.0 with the same issue:

Rate exceeded for operation 'AWS::CloudFront::Distribution'.

when trying to update all my nested stacks (around 130) each with their own cloudfront distribution.

Expected Behavior

There should be a retry mechanism with backoff, instead of failing the deployment. There is currently no way to control that in the cdk deployment, so my deployments fail. I know we can add dependencies between the nested stacks, but that seems like not a great solution to add a stack dependency for the sake of deployment throttling to update API's

There was a similar issue with log retention: #26837

Current Behavior

Resource update fails with:

Rate exceeded for operation 'AWS::CloudFront::Distribution'.

Deployment is cancelled and rolled back.

Reproduction Steps

Deploy an update to > 100 cloudfront distributions in a cdk deployment

Possible Solution

CDK deployment should retry and do a backoff if getting throttled by cloudfront update API

Additional Information/Context

No response

CDK CLI Version

2.127

Framework Version

No response

Node.js Version

18

OS

MAc OS 14.2.1

Language

TypeScript

Language Version

No response

Other information

No response

@shaelm shaelm added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 20, 2024
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Feb 20, 2024
@pahud
Copy link
Contributor

pahud commented Feb 20, 2024

CDK does not handle the deployment failure due to rate limit exceeded and we need more discussion about that. At this moment, I guess you will need to ensure the distributions dependency using addDependency() and make sure multiple distributions would not be deployed at the same time.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 20, 2024
@shaelm
Copy link
Author

shaelm commented Feb 20, 2024

Is there no other workaround?

I'm hesitant to add dependencies between stacks for the sake of it that really aren't dependent on each other just to slow down the deployment

@pahud
Copy link
Contributor

pahud commented Feb 21, 2024

Unfortunately this is probably the only workaround from CDK as the limitation is from CFN and service, not CDK.

Another approach off the top of my head is to reach out to the AWS support to discuss your use case and see if it's possible to raise the limit of your AWS account but that is beyond the scope of CDK.

@pahud pahud added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 21, 2024
@shaelm
Copy link
Author

shaelm commented Feb 21, 2024

In #26837, they implemented a cdk property, logRetentionRetryOptions?, (source: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_logs.LogRetention.html_) which solved this exact problem due to a low tps API from the service team.

Could we do something similar for cloudfront distribution constructs?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 21, 2024
@pahud
Copy link
Contributor

pahud commented Jun 3, 2024

logRetentionRetryOptions is for CDK custom resource which CDK has the control over it but deploying 130+ cloudfront distributions at the same time could hit the service limit from the cloudffront team. This could happen even when you just use cloudformation without CDK.

This is not something CDK can do to work it around except ensuring the dependency. I suggest you create a premium support ticket and discuss this with the premium support team to escalate your concern to the service team.

@pahud pahud added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 3, 2024
Copy link

github-actions bot commented Jun 5, 2024

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants