Class: AWSCDK::EC2::WindowsImage

Inherits:
GenericSSMParameterImage
  • Object
show all
Defined in:
ec2/windows_image.rb

Overview

Select the latest version of the indicated Windows version.

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.

https://aws.amazon.com/blogs/mt/query-for-the-latest-windows-ami-using-systems-manager-parameter-store/

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version, props = nil) ⇒ WindowsImage

Returns a new instance of WindowsImage.

Parameters:



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

def initialize(version, props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::WindowsImageProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLldpbmRvd3NWZXJzaW9uIn0=")), "version")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLldpbmRvd3NJbWFnZVByb3BzIn0=")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(version, props)
end

Class Method Details

.jsii_overridable_methodsObject



26
27
28
29
30
31
# File 'ec2/windows_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/windows_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/windows_image.rb', line 36

def parameter_name()
  jsii_get_property("parameterName")
end