Module: AwsHelpers

Extended by:
AwsHelpers
Included in:
AwsHelpers
Defined in:
lib/aws_helpers.rb,
lib/aws_helpers/version.rb,
lib/aws_helpers/ec2/image.rb,
lib/aws_helpers/rds/instance.rb,
lib/aws_helpers/rds/snapshot.rb,
lib/aws_helpers/rds/snapshot_progress.rb,
lib/aws_helpers/elastic_beanstalk/events.rb,
lib/aws_helpers/elastic_beanstalk/version.rb,
lib/aws_helpers/cloud_formation/stack_delete.rb,
lib/aws_helpers/cloud_formation/stack_status.rb,
lib/aws_helpers/cloud_formation/stack_update.rb,
lib/aws_helpers/cloud_formation/stack_exists.rb,
lib/aws_helpers/cloud_formation/stack_create.rb,
lib/aws_helpers/cloud_formation/stack_outputs.rb,
lib/aws_helpers/cloud_formation/describe_stack.rb,
lib/aws_helpers/elastic_beanstalk/version_file.rb,
lib/aws_helpers/cloud_formation/stack_progress.rb,
lib/aws_helpers/cloud_formation/stack_provision.rb,
lib/aws_helpers/cloud_formation/upload_template.rb,
lib/aws_helpers/cloud_formation/stack_parameters.rb,
lib/aws_helpers/cloud_formation/poll_stack_status.rb,
lib/aws_helpers/cloud_formation/stack_error_events.rb,
lib/aws_helpers/cloud_formation/check_stack_failure.rb,
lib/aws_helpers/elastic_beanstalk/version_zip_folder.rb,
lib/aws_helpers/elastic_beanstalk/application_version.rb,
lib/aws_helpers/elastic_load_balancing/instance_state.rb,
lib/aws_helpers/cloud_formation/stack_modify_parameters.rb,
lib/aws_helpers/auto_scaling_group/update_desired_capacity.rb,
lib/aws_helpers/auto_scaling_group/retrieve_desired_capacity.rb,
lib/aws_helpers/elastic_load_balancing/poll_healthy_instances.rb

Defined Under Namespace

Modules: AutoScalingGroup, CloudFormation, EC2, ElasticBeanstalk, ElasticLoadBalancing, RDS

Constant Summary collapse

COMMON_OPTIONS =
{ retry_limit: 5 }
VERSION =
'2.0.1'

Class Method Summary collapse

Class Method Details

.auto_scaling_group_retrieve_desired_capacity(auto_scaling_group_name) ⇒ Object


55
56
57
# File 'lib/aws_helpers.rb', line 55

def auto_scaling_group_retrieve_desired_capacity(auto_scaling_group_name)
  AutoScalingGroup::RetrieveDesiredCapacity.new(auto_scaling_client, auto_scaling_group_name).execute
end

.auto_scaling_group_update_desired_capacity(auto_scaling_group_name, desired_capacity, timeout) ⇒ Object


59
60
61
# File 'lib/aws_helpers.rb', line 59

def auto_scaling_group_update_desired_capacity(auto_scaling_group_name, desired_capacity, timeout)
  AutoScalingGroup::UpdateDesiredCapacity.new(auto_scaling_client, elb_client, auto_scaling_group_name, desired_capacity, timeout).execute
end

.beanstalk_deploy(application, environment, version) ⇒ Object


63
64
65
# File 'lib/aws_helpers.rb', line 63

def beanstalk_deploy(application, environment, version)
  ElasticBeanstalk::Version.new(elastic_beanstalk_client, s3_client, iam_client).deploy(application, environment, version)
end

.beanstalk_upload(application, version, version_contents, zip_folder) ⇒ Object


67
68
69
# File 'lib/aws_helpers.rb', line 67

def beanstalk_upload(application, version, version_contents, zip_folder)
  ElasticBeanstalk::Version.new(elastic_beanstalk_client, s3_client, iam_client).upload(application, version, version_contents, zip_folder)
end

.ec2_image_create(name, instance_id, additional_tags = []) ⇒ Object


83
84
85
# File 'lib/aws_helpers.rb', line 83

def ec2_image_create(name, instance_id, additional_tags = [])
  EC2::Image.new(ec2_client).create(instance_id, name, additional_tags)
end

.ec2_images_delete(name, options = nil) ⇒ Object


87
88
89
# File 'lib/aws_helpers.rb', line 87

def ec2_images_delete(name, options = nil)
  EC2::Image.new(ec2_client).delete(name, options)
end

.ec2_images_delete_by_time(name, time) ⇒ Object


91
92
93
# File 'lib/aws_helpers.rb', line 91

def ec2_images_delete_by_time(name, time)
  EC2::Image.new(ec2_client).delete_by_time(name, time)
end

.ec2_images_find_by_tags(tags) ⇒ Object


95
96
97
# File 'lib/aws_helpers.rb', line 95

def ec2_images_find_by_tags(tags)
  EC2::Image.new(ec2_client).find_by_tag(tags)
end

.elb_poll_healthy_instances(load_balancer_name, required_instances, timeout) ⇒ Object


51
52
53
# File 'lib/aws_helpers.rb', line 51

def elb_poll_healthy_instances(load_balancer_name, required_instances, timeout)
  ElasticLoadBalancing::PollHealthyInstances.new(elb_client, load_balancer_name, required_instances, timeout).execute
end

.rds_snapshot_create(db_instance_id, use_name = false) ⇒ Object


71
72
73
# File 'lib/aws_helpers.rb', line 71

def rds_snapshot_create(db_instance_id, use_name = false)
  RDS::Snapshot.new(rds_client, iam_client, db_instance_id, use_name).create
end

.rds_snapshot_latest(db_instance_id) ⇒ Object


79
80
81
# File 'lib/aws_helpers.rb', line 79

def rds_snapshot_latest(db_instance_id)
  RDS::Snapshot.new(rds_client, iam_client, db_instance_id).latest
end

.rds_snapshots_delete(db_instance_id, options = nil) ⇒ Object


75
76
77
# File 'lib/aws_helpers.rb', line 75

def rds_snapshots_delete(db_instance_id, options = nil)
  RDS::Snapshot.new(rds_client, iam_client, db_instance_id).delete(options)
end

.stack_delete(stack_name) ⇒ Object


35
36
37
# File 'lib/aws_helpers.rb', line 35

def stack_delete(stack_name)
  CloudFormation::StackDelete.new(cf_client, stack_name).execute
end

.stack_exists?(stack_name) ⇒ Boolean

Returns:

  • (Boolean)

47
48
49
# File 'lib/aws_helpers.rb', line 47

def stack_exists?(stack_name)
  CloudFormation::StackExists.new(cf_client, stack_name).execute
end

.stack_modify_parameters(stack_name, parameters) ⇒ Object


31
32
33
# File 'lib/aws_helpers.rb', line 31

def stack_modify_parameters(stack_name, parameters)
  CloudFormation::StackModifyParameters.new(cf_client, stack_name, parameters).execute
end

.stack_outputs(stack_name) ⇒ Object


39
40
41
# File 'lib/aws_helpers.rb', line 39

def stack_outputs(stack_name)
  CloudFormation::StackOutputs.new(cf_client, stack_name).execute
end

.stack_parameters(stack_name) ⇒ Object


43
44
45
# File 'lib/aws_helpers.rb', line 43

def stack_parameters(stack_name)
  CloudFormation::StackParameters.new(cf_client, stack_name).execute
end

.stack_provision(stack_name, template, options = {}) ⇒ Object


23
24
25
# File 'lib/aws_helpers.rb', line 23

def stack_provision(stack_name, template, options = {})
  CloudFormation::StackProvision.new(cf_client, s3_client, stack_name, template, options).execute
end

.stack_s3_provision(stack_name, template, bucket_name, options = {}, bucket_encrypt = false) ⇒ Object


27
28
29
# File 'lib/aws_helpers.rb', line 27

def stack_s3_provision(stack_name, template, bucket_name, options = {}, bucket_encrypt = false)
  CloudFormation::StackProvision.new(cf_client, s3_client, stack_name, template, options.merge(bucket_name: bucket_name, bucket_encrypt: bucket_encrypt)).execute
end