Skip to content

Instantly share code, notes, and snippets.

@ejfinneran
Created January 13, 2015 17:40
Show Gist options
  • Save ejfinneran/ec33232ec5ab19825d23 to your computer and use it in GitHub Desktop.
Save ejfinneran/ec33232ec5ab19825d23 to your computer and use it in GitHub Desktop.
Getting AWS Account ID via Fog
require 'fog'
iam = Fog::AWS::IAM.new({
aws_access_key_id: "REDACTED",
aws_secret_access_key: "REDACTED",
})
response = iam.get_user("foo")
puts response.body["User"]["Arn"]
=> arn:aws:iam::111122223333:user/foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment