Skip to content

Instantly share code, notes, and snippets.

@amosshapira
Created March 2, 2015 01:31
Show Gist options
  • Save amosshapira/e043ef116bfdfe92e3cd to your computer and use it in GitHub Desktop.
Save amosshapira/e043ef116bfdfe92e3cd to your computer and use it in GitHub Desktop.
Reading AWS cli keys into vagrant-aws configuration
# NOTE: Uses ~/.aws/config to get the region and ~/.aws/credentials to get
# AWS credentials.
# TODO: When running on EC2, use the auto-IAM data
config.vm.provider :aws do |aws, override|
aws_credentials = IniFile.load(File.expand_path('~/.aws/credentials'))
aws.access_key_id = aws_credentials['default']['aws_access_key_id']
aws.secret_access_key = aws_credentials['default']['aws_secret_access_key']
aws_config = IniFile.load(File.expand_path('~/.aws/config'))
aws.region = aws_config['default']['region']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment