Class: ESP::AWSClients

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/esp/aws_clients.rb

Constant Summary collapse

ESP_OWNER_ID =
{ "production" => "613698206329".freeze }.freeze
AWS_ROLE_NAME =
"Evident-Service-Role-AutoCreate".freeze
AWS_ROLE_POLICY_ARN =
"arn:aws:iam::aws:policy/SecurityAudit".freeze

Instance Method Summary collapse

Instance Method Details

#create_and_attach_role!(external_account_id) ⇒ Object



13
14
15
16
17
# File 'lib/esp/aws_clients.rb', line 13

def create_and_attach_role!()
  role = iam.create_role(role_name: AWS_ROLE_NAME, assume_role_policy_document: trust_policy())
  iam.attach_role_policy(role_name: AWS_ROLE_NAME, policy_arn: AWS_ROLE_POLICY_ARN)
  role
end

#owner_idObject



19
20
21
# File 'lib/esp/aws_clients.rb', line 19

def owner_id
  @owner_id ||= ec2.describe_security_groups.security_groups[0].owner_id
end