Method: Jets::AwsInfo#account

Defined in:
lib/jets/aws_info.rb

#accountObject

aws sts get-caller-identity



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/jets/aws_info.rb', line 50

def 
  return '123456789' if Jets.env.test?
  return ENV['JETS_AWS_ACCOUNT'] if ENV['JETS_AWS_ACCOUNT']

  # ensure region set, required for sts.get_caller_identity.account to work
  ENV['AWS_REGION'] ||= region
  begin
    sts.get_caller_identity.
  rescue Aws::Errors::MissingCredentialsError, Aws::Errors::NoSuchEndpointError, Aws::STS::Errors::InvalidClientTokenId
    puts "INFO: You're missing AWS credentials. Only local services are currently available"
  rescue Seahorse::Client::NetworkingError
    puts "INFO: No internet connection available. Only local services are currently available"
  end
end