Module: Smash::CloudPowers::AwsResources

Includes:
Auth, Helper, Zenv
Included in:
Smash::CloudPowers, Delegator, SelfAwareness, Storage
Defined in:
lib/cloud_powers/aws_resources.rb

Instance Method Summary collapse

Methods included from Zenv

#env_vars, #i_vars, #project_root, #project_root=, #system_vars, #zfind

Methods included from Helper

#attr_map!, #called_from, #create_logger, #errors, #format_error_message, #log_file, #logger, #smart_retry, #task_path, #task_require_path, #to_camel, #to_i_var, #to_pascal, #to_ruby_file_name, #to_snake, #update_message_body

Methods included from Auth

creds

Instance Method Details

#ec2 ⇒ Object



16
17
18
19
20
21
# File 'lib/cloud_powers/aws_resources.rb', line 16

def ec2
  @ec2 ||= Aws::EC2::Client.new(
    region: region,
    credentials: Auth.creds
  )
end

#image(name) ⇒ Object



23
24
25
26
27
# File 'lib/cloud_powers/aws_resources.rb', line 23

def image(name)
  ec2.describe_images(
    filters: [{ name: 'tag:aminame', values: [name.to_s] }]
  ).images.first
end

#kinesis ⇒ Object



29
30
31
32
33
34
# File 'lib/cloud_powers/aws_resources.rb', line 29

def kinesis
  @kinesis ||= Aws::Kinesis::Client.new(
    region: region,
    credentials: Auth.creds,
  )
end

#region ⇒ Object



12
13
14
# File 'lib/cloud_powers/aws_resources.rb', line 12

def region
  zfind('Aws Region')
end

#s3 ⇒ Object



36
37
38
39
40
41
# File 'lib/cloud_powers/aws_resources.rb', line 36

def s3
  @s3 ||= Aws::S3::Client.new(
    region: region,
    credentials: Auth.creds
  )
end