-
Notifications
You must be signed in to change notification settings - Fork 1
Awskeyring as a Gem.
Tristan Morgan edited this page Sep 13, 2021
·
2 revisions
Awskeyring has been created to also be used as a Gem (ruby Library) that can be embedded in other applications. The interactions with the AWS API are all contained in a module and documented on Ruby Doc. An example repo called Vaulttool show's how this can be done.
One example of using Awskeyring as a credential_provider to the AWS-SDK's STS Client.
require 'awskeyring/credential_provider'
client = Aws::STS::Client.new(
credentials: Awskeyring::CredentialProvider.new("company-acc")
)
Another example is to open the AWS console in your browser with access keys from you environment.
login_url = Awskeyring::Awsapi.get_login_url(
key: ENV['AWS_ACCESS_KEY_ID'],
secret: ENV['AWS_SECRET_ACCESS_KEY'],
token: ENV['AWS_SESSION_TOKEN'],
path: 'ec2/v2',
user: ENV['USER']
)
pid = Process.spawn("open \"#{login_url}\"")
Process.wait pid