99designs / iamy

A cli tool for importing and exporting AWS IAM configuration to YAML files
MIT License
238 stars 24 forks source link

Error fetching S3 data #18

Closed grassdog closed 8 years ago

grassdog commented 8 years ago

Hi,

I'm using version v2.0.0-beta2 (love the list normalisation change btw) and have run into an issue when pulling down S3 data.

$ iamy pull
Error fetching S3 data: Error listing buckets: Error while calling ListBuckets: MissingRegion: could not find region configuration130 <nil>

Not sure where configuration130 is coming from. Any ideas on why it's getting an incorrect region?

bradfeehan commented 8 years ago

I'm affected by this issue as well. There is some discussion on this issue in https://github.com/99designs/iamy/issues/13#issuecomment-243978842. Setting default_region in my ~/.aws/config doesn't fix it, but setting region = us-east-1 does fix it for me, and I'm happy with this workaround for now until it gets fixed.

grassdog commented 8 years ago

Gotcha. Thanks for the pointer to that.

mtibben commented 8 years ago

Ah yes. We should probably provide a clearer error message. The annoyance is that this tool requires the aws tool to be configured correctly, however the SDK doesn't pick up the aws cli config.

This has now been fixed in the SDK https://github.com/aws/aws-sdk-go/pull/761 so the fix should be to enable that feature

mtibben commented 8 years ago

I've addressed this issue in #20 @grassdog. Give it a go and see if works for you as I've only been using aws-vault and I'm sure there's other ways of configuring the AWS CLI that I'm not testing

https://github.com/99designs/iamy/releases/tag/v2.0.0-beta3

grassdog commented 8 years ago

I run it via aws-vault too. If I set AWS_REGION when I run it, it completes fine.

i.e. AWS_REGION=us-east-1 aws-vault exec admin -- iamy pull

lox commented 8 years ago

Do you have a region defined in your ~/.aws/config for the admin profile?

See https://github.com/99designs/aws-vault/blob/d84315c29bbe45ab979a94f0bcecfcb7ecb307a8/exec.go#L97

grassdog commented 8 years ago

I had it under the default profile but I guess that wasn't being cascaded down to admin. I just added it to admin and it runs a treat without the ENV variable being set. 🎉

lox commented 8 years ago

Yeah, it's confusing like that. Glad that fixes it for you @grassdog.

mtibben commented 8 years ago

OK great, thanks @grassdog, will resolve this issue