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

时间:2019-03-06 06:13:49

标签: python amazon-web-services boto3 bitbucket-pipelines bitbucket-aws-code-deploy

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

  

管道失败...

+ 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

有什么方法可以增加速率限制之前的值或减少发生的机会?

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

1 个答案:

答案 0 :(得分:2)

不幸的是,由于AWS API动态设置了速率限制,因此无法提高速率限制。

  

AWS支持:

     

此问题与任何并发部署或任何其他与资源相关的限制均无关。这是一个无法解决的问题。

     

同时启动的多个API调用在我们的端点受到限制。每个端点的限制是变化的,并且是动态的,因此任何地方都没有记录。

     

在这种情况下,同时有多个对“ GetDeployment” API的调用,因此这些调用受到限制。

     

在这种情况下,我们建议实现错误重试和重试之间的指数回退,以使API调用不会同时发生。

     

您可以检查下面的链接,该链接说明了如何在我们的《准则》中实施它。   -https://docs.aws.amazon.com/general/latest/gr/api-retries.html

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

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

BOTO3 RETRY CONFIG: https://github.com/boto/botocore/issues/882#issuecomment-338846339

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

  

管道成功...

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

注意:随着我根据部署情况修改用法,我将在此信息中更新更多信息。