Class: AWSCDK::EC2::GenericSSMParameterImage

Inherits:
Jsii::Object
  • Object
show all
Includes:
IMachineImage
Defined in:
ec2/generic_ssm_parameter_image.rb

Overview

Select the image based on a given SSM parameter at deployment time of the CloudFormation Stack.

This Machine Image automatically updates to the latest version on every deployment. Be aware this will cause your instances to be replaced when a new version of the image becomes available. Do not store stateful information on the instance if you are using this image.

The AMI ID is selected using the values published to the SSM parameter store.

Direct Known Subclasses

AmazonLinuxImage, WindowsImage

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameter_name, os, user_data = nil) ⇒ GenericSSMParameterImage

Returns a new instance of GenericSSMParameterImage.

Parameters:



19
20
21
22
23
24
# File 'ec2/generic_ssm_parameter_image.rb', line 19

def initialize(parameter_name, os, user_data = nil)
  Jsii::Type.check_type(parameter_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "parameterName")
  Jsii::Type.check_type(os, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk9wZXJhdGluZ1N5c3RlbVR5cGUifQ==")), "os")
  Jsii::Type.check_type(user_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlVzZXJEYXRhIn0=")), "userData") unless user_data.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(parameter_name, os, user_data)
end

Class Method Details

.jsii_overridable_methodsObject



26
27
28
29
30
31
# File 'ec2/generic_ssm_parameter_image.rb', line 26

def self.jsii_overridable_methods
  {
    :parameter_name => { kind: :property, name: "parameterName", is_optional: false },
    :get_image => { kind: :method, name: "getImage", is_optional: false },
  }
end

Instance Method Details

#get_image(scope) ⇒ AWSCDK::EC2::MachineImageConfig

Return the image to use in the given context.

Parameters:

  • scope (Constructs::Construct)

Returns:



44
45
46
47
# File 'ec2/generic_ssm_parameter_image.rb', line 44

def get_image(scope)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  jsii_call_method("getImage", [scope])
end

#parameter_nameString

Name of the SSM parameter we're looking up.

Returns:

  • (String)


36
37
38
# File 'ec2/generic_ssm_parameter_image.rb', line 36

def parameter_name()
  jsii_get_property("parameterName")
end