调用 GetDeployment 操作时发生错误 (ThrottlingException)(达到最大重试次数:4):超出速率

An error occurred (ThrottlingException) when calling the GetDeployment operation (reached max retries: 4): Rate exceeded

随着 AWS CodeDeploy 中部署组数量的增加,BitBucket 管道开始更频繁地失败。

PIPELINE FAILED...

+ python ./_scripts/codedeploy_deploy.py
Failed to deploy application revision.
An error occurred (ThrottlingException) when calling the GetDeployment operation (reached max retries: 4): Rate exceeded

有什么办法可以提高rate limit之前的值或者降低出现的几率吗?

AWS 论坛 POST: https://forums.aws.amazon.com/thread.jspa?messageID=892511

遗憾的是,无法提高速率限制,因为这是由 AWS API 动态配置的。

AWS SUPPORT:

This issue is not related to any concurrent deployment or any other resource related limit. This is a throttling issue, which cannot be changed.

Multiple API calls initiated at the same time gets throttled at our endpoints. The limit for each endpoint is varies and is dynamic, therefore it is not documented anywhere.

In this case, there are multiple calls for 'GetDeployment' API simultaneously hence the calls are getting throttled.

In such scenarios we recommend to implement error retries and exponential backoff between retries, so that the API calls are not simultaneous.

You can check the below link which explains how to implement it in our Code. - https://docs.aws.amazon.com/general/latest/gr/api-retries.html

我能够实施指数退避以降低我们尝试获取部署状态的速度,并增加部署失败前的重试次数。

确保您使用的是支持此新配置系统的最新版本的 BOTO3 (boto3-1.9.108 botocore-1.12.108)

BOTO3 重试配置: https://github.com/boto/botocore/issues/882#issuecomment-338846339

分叉: https://bitbucket.org/DJRavine/aws-codedeploy-bitbucket-pipelines-python/src/master/ GIST: https://gist.github.com/djravine/5007e2a7f726cebe14ea51c7ee54bf5d

PIPELINE SUCCESSFUL...

+ python ./_scripts/codedeploy_deploy.py
Deployment Created (Exponential back off 30s)
Deployment InProgress (Exponential back off 60s)
Deployment Succeeded

注意:我将根据我们的部署修改使用情况,并使用更多信息更新此 post。