Module: SmPs::AwsHelpers
- Defined in:
- lib/smps/aws.rb
Overview
Some helpers to setup and interact with various aws services.
Constant Summary collapse
- SSM_PARAMETER_TYPES =
%w[String StringList SecureString].freeze
Instance Method Summary collapse
- #aws_region ⇒ Object
- #configure_aws_region(region = nil) ⇒ Object
- #credentials_from_role(role, debug = false) ⇒ Object
- #initialize_instance_type ⇒ Object
- #instance_type ⇒ Object
- #user_data(source, type = :auto) ⇒ Object
Instance Method Details
#aws_region ⇒ Object
28 29 30 |
# File 'lib/smps/aws.rb', line 28 def aws_region @aws_region ||= initialize_aws_region end |
#configure_aws_region(region = nil) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/smps/aws.rb', line 41 def configure_aws_region(region = nil) if region ::Aws.config.update(region: region) else ::Aws.config.update(region: aws_region) end end |
#credentials_from_role(role, debug = false) ⇒ Object
36 37 38 39 |
# File 'lib/smps/aws.rb', line 36 def credentials_from_role(role, debug = false) @aws_session ||= initialize_aws_session_from_role(role, debug) @aws_session.credentials end |
#initialize_instance_type ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/smps/aws.rb', line 17 def initialize_instance_type i_type = nil if ENV['ECS_CONTAINER_METADATA_URI_V4'] i_type = 'ecs' else get_resource('http://169.254.169.254/latest') i_type = 'ec2' end i_type end |
#instance_type ⇒ Object
13 14 15 |
# File 'lib/smps/aws.rb', line 13 def instance_type @instance_type ||= initialize_instance_type end |
#user_data(source, type = :auto) ⇒ Object
32 33 34 |
# File 'lib/smps/aws.rb', line 32 def user_data(source, type = :auto) @user_data ||= initialize_user_data(source, type) end |