Module: OpenStax::Aws

Defined in:
lib/openstax_aws.rb,
lib/openstax/aws/tag.rb,
lib/openstax/aws/alarm.rb,
lib/openstax/aws/image.rb,
lib/openstax/aws/stack.rb,
lib/openstax/aws/system.rb,
lib/openstax/aws/secrets.rb,
lib/openstax/aws/version.rb,
lib/openstax/aws/template.rb,
lib/openstax/aws/sam_stack.rb,
lib/openstax/aws/change_set.rb,
lib/openstax/aws/event_rule.rb,
lib/openstax/aws/git_helper.rb,
lib/openstax/aws/msk_cluster.rb,
lib/openstax/aws/secrets_set.rb,
lib/openstax/aws/stack_event.rb,
lib/openstax/aws/distribution.rb,
lib/openstax/aws/packer_1_2_5.rb,
lib/openstax/aws/packer_1_4_1.rb,
lib/openstax/aws/rds_instance.rb,
lib/openstax/aws/s3_text_file.rb,
lib/openstax/aws/stack_status.rb,
lib/openstax/aws/wait_message.rb,
lib/openstax/aws/stack_factory.rb,
lib/openstax/aws/packer_factory.rb,
lib/openstax/aws/deployment_base.rb,
lib/openstax/aws/secrets_factory.rb,
lib/openstax/aws/resource_factory.rb,
lib/openstax/aws/stack_parameters.rb,
lib/openstax/aws/ec2_instance_data.rb,
lib/openstax/aws/auto_scaling_group.rb,
lib/openstax/aws/auto_scaling_instance.rb,
lib/openstax/aws/build_image_command_1.rb,
lib/openstax/aws/secrets_specification.rb

Defined Under Namespace

Modules: GitHelper, System Classes: Alarm, AutoScalingGroup, AutoScalingInstance, BuildImageCommand1, ChangeSet, Configuration, DeploymentBase, Distribution, Ec2InstanceData, EventRule, Image, MskCluster, PackerFactory, Packer_1_2_5, Packer_1_4_1, RdsInstance, ResourceFactory, S3TextFile, SamStack, Secrets, SecretsFactory, SecretsSet, SecretsSpecification, SecretsSpecificationFactory, SecretsSubstitutionsFactory, Stack, StackFactory, StackParameters, Tag, Template, WaitMessage

Constant Summary collapse

VERSION =
"2.0.0"

Class Method Summary collapse

Class Method Details

.configurationObject



40
41
42
# File 'lib/openstax_aws.rb', line 40

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



36
37
38
# File 'lib/openstax_aws.rb', line 36

def self.configure
  yield configuration
end

.loggerObject



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

def self.logger
  configuration.logger
end

.verify_secrets_populated!Object



20
21
22
23
24
# File 'lib/openstax_aws.rb', line 20

def self.verify_secrets_populated!
  if ENV['AWS_ACCESS_KEY_ID'].nil? || ENV['AWS_SECRET_ACCESS_KEY'].nil?
    raise "AWS key and secret are not both set!"
  end
end

.verify_template_bucket_access!Object



26
27
28
29
30
31
32
33
34
# File 'lib/openstax_aws.rb', line 26

def self.verify_template_bucket_access!
  begin
    ::Aws::S3::Client.new(region: configuration.cfn_template_bucket_region)
                   .head_bucket(bucket: configuration.cfn_template_bucket_name)
  rescue ::Aws::S3::Errors::Forbidden => ee
    raise "The provided AWS credentials cannot access the template bucket. Please " \
          "verify that you are using the correct credentials for the targeted AWS account."
  end
end