Aws-cli: Add --retry to overcome intermittent failures

Created on 19 Nov 2016  路  2Comments  路  Source: aws/aws-cli

Hello,

I'm experiencing the same issue as reported on https://forums.aws.amazon.com/thread.jspa?threadID=237416 where sometimes an EC2 instance, although launched with an IAM role, isn't able to perform API calls (e.g. download from S3) and fails with "Unable to locate credentials."

This breaks bootstrap scripts that rely on the EC2 instance being able to work with other AWS resources.

A --retry option will make it possible to automatically retry, potentially with a backoff, the same request several times to overcome such failures.

guidance

Most helpful comment

You can increase the retry count by setting metadata_service_num_attempts in your config file. For example:

aws configure set metadata_service_num_attempts 5 --profile profile-name

--profile can be omitted if you're setting it on the default profile.

All 2 comments

You can increase the retry count by setting metadata_service_num_attempts in your config file. For example:

aws configure set metadata_service_num_attempts 5 --profile profile-name

--profile can be omitted if you're setting it on the default profile.

Sure, but this fails on AWS EC2:

$ aws configure set metadata_service_num_attempts 5
$ aws s3 cp s3://foo/bar /foo/bar

'str' object cannot be interpreted as an integer
$ 

Supposedly fixed here.

EDIT: Might be the Debian image I'm using... sigh

Was this page helpful?
0 / 5 - 0 ratings