inspec/libraries/aws_conn.rb
sfreeman d9221bb925 Add ability to choose a user by username
Add has MFA enabled member
Add "has console password" member

Signed-off-by: sfreeman <Steffanie.Freeman@d2l.com>
2017-03-15 15:49:13 -04:00

31 lines
581 B
Ruby

# author: Christoph Hartmann
class AWSConnection
def initialize
require 'aws-sdk'
opts = {
region: ENV['AWS_DEFAULT_REGION'],
credentials: Aws::Credentials.new(
ENV['AWS_ACCESS_KEY_ID'],
ENV['AWS_SECRET_ACCESS_KEY'],
),
}
Aws.config.update(opts)
end
def ec2_resource
@ec2_resource ||= Aws::EC2::Resource.new
end
def ec2_client
@ec2_client ||= Aws::EC2::Client.new
end
def iam_resource
@iam_resource ||= Aws::IAM::Resource.new
end
def iam_client
@iam_client ||= Aws::IAM::Client.new
end
end