Skip to content

Instantly share code, notes, and snippets.

@joshlove
Created May 10, 2017 01:23
Show Gist options
  • Save joshlove/d9fcb4cd8a5da7cc653cb80505c7f794 to your computer and use it in GitHub Desktop.
Save joshlove/d9fcb4cd8a5da7cc653cb80505c7f794 to your computer and use it in GitHub Desktop.
aws_creds_file.rb
require 'inifile'
unless @key_id
aws_credentials=IniFile.load(ENV['HOME']+'/.aws/credentials')
puts "Profiles in ~/.aws/credentials:"
aws_credentials.sections.each do |section|
section_index = aws_credentials.sections.index(section)
puts section_index.to_s + ": " + section
end
puts "Enter the number for the corresponding AWS profile: "
profile_id = gets.chomp.to_i
@key_id = aws_credentials.sections[profile_id]
end
puts @key_id
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment