Module: Smash::CloudPowers::AwsResources

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

Instance Method Summary collapse

Methods included from Zenv

#env_vars, #file_tree_search, #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, #valid_json?

Methods included from Auth

creds

Instance Method Details

#ec2Object



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

#kinesisObject



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

#regionObject



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

def region
  zfind('Aws Region')
end

#s3Object



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

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

#sqsObject



44
45
46
# File 'lib/cloud_powers/aws_resources.rb', line 44

def sqs
  @sqs ||= Aws::SQS::Client.new(credentials: Auth.creds)
end