Created
May 10, 2017 01:23
-
-
Save joshlove/d9fcb4cd8a5da7cc653cb80505c7f794 to your computer and use it in GitHub Desktop.
aws_creds_file.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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