Class: AWSCDK::EC2::CfnInstance::MetadataOptionsProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/cfn_instance.rb

Overview

Specifies the metadata options for the instance.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_endpoint: nil, http_protocol_ipv6: nil, http_put_response_hop_limit: nil, http_tokens: nil, instance_metadata_tags: nil) ⇒ MetadataOptionsProperty

Returns a new instance of MetadataOptionsProperty.

Parameters:

  • http_endpoint (String, nil) (defaults to: nil)

    Enables or disables the HTTP metadata endpoint on your instances.

  • http_protocol_ipv6 (String, nil) (defaults to: nil)

    Enables or disables the IPv6 endpoint for the instance metadata service.

  • http_put_response_hop_limit (Numeric, nil) (defaults to: nil)

    The maximum number of hops that the metadata token can travel.

  • http_tokens (String, nil) (defaults to: nil)

    Indicates whether IMDSv2 is required.

  • instance_metadata_tags (String, nil) (defaults to: nil)

    Set to enabled to allow access to instance tags from the instance metadata.



1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
# File 'ec2/cfn_instance.rb', line 1884

def initialize(http_endpoint: nil, http_protocol_ipv6: nil, http_put_response_hop_limit: nil, http_tokens: nil, instance_metadata_tags: nil)
  @http_endpoint = http_endpoint
  Jsii::Type.check_type(@http_endpoint, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "httpEndpoint") unless @http_endpoint.nil?
  @http_protocol_ipv6 = http_protocol_ipv6
  Jsii::Type.check_type(@http_protocol_ipv6, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "httpProtocolIpv6") unless @http_protocol_ipv6.nil?
  @http_put_response_hop_limit = http_put_response_hop_limit
  Jsii::Type.check_type(@http_put_response_hop_limit, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "httpPutResponseHopLimit") unless @http_put_response_hop_limit.nil?
  @http_tokens = http_tokens
  Jsii::Type.check_type(@http_tokens, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "httpTokens") unless @http_tokens.nil?
  @instance_metadata_tags = 
  Jsii::Type.check_type(@instance_metadata_tags, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceMetadataTags") unless @instance_metadata_tags.nil?
end

Instance Attribute Details

#http_endpointString? (readonly)

Enables or disables the HTTP metadata endpoint on your instances.

If you specify a value of disabled , you cannot access your instance metadata.

Default: enabled



1905
1906
1907
# File 'ec2/cfn_instance.rb', line 1905

def http_endpoint
  @http_endpoint
end

#http_protocol_ipv6String? (readonly)

Enables or disables the IPv6 endpoint for the instance metadata service.

Default: disabled



1912
1913
1914
# File 'ec2/cfn_instance.rb', line 1912

def http_protocol_ipv6
  @http_protocol_ipv6
end

#http_put_response_hop_limitNumeric? (readonly)

Note:

Default: - 1

The maximum number of hops that the metadata token can travel.

Possible values: Integers from 1 to 64



1920
1921
1922
# File 'ec2/cfn_instance.rb', line 1920

def http_put_response_hop_limit
  @http_put_response_hop_limit
end

#http_tokensString? (readonly)

Indicates whether IMDSv2 is required.

  • optional - IMDSv2 is optional, which means that you can use either IMDSv2 or IMDSv1.
  • required - IMDSv2 is required, which means that IMDSv1 is disabled, and you must use IMDSv2.

Default:

  • If the value of ImdsSupport for the Amazon Machine Image (AMI) for your instance is v2.0 and the account level default is set to no-preference , the default is required .
  • If the value of ImdsSupport for the Amazon Machine Image (AMI) for your instance is v2.0 , but the account level default is set to V1 or V2 , the default is optional .

The default value can also be affected by other combinations of parameters. For more information, see Order of precedence for instance metadata options in the Amazon EC2 User Guide .



1935
1936
1937
# File 'ec2/cfn_instance.rb', line 1935

def http_tokens
  @http_tokens
end

#instance_metadata_tagsString? (readonly)

Set to enabled to allow access to instance tags from the instance metadata.

Set to disabled to turn off access to instance tags from the instance metadata. For more information, see Work with instance tags using the instance metadata .

Default: disabled



1944
1945
1946
# File 'ec2/cfn_instance.rb', line 1944

def 
  @instance_metadata_tags
end

Class Method Details

.jsii_propertiesObject



1946
1947
1948
1949
1950
1951
1952
1953
1954
# File 'ec2/cfn_instance.rb', line 1946

def self.jsii_properties
  {
    :http_endpoint => "httpEndpoint",
    :http_protocol_ipv6 => "httpProtocolIpv6",
    :http_put_response_hop_limit => "httpPutResponseHopLimit",
    :http_tokens => "httpTokens",
    :instance_metadata_tags => "instanceMetadataTags",
  }
end

Instance Method Details

#to_jsiiObject



1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
# File 'ec2/cfn_instance.rb', line 1956

def to_jsii
  result = {}
  result.merge!({
    "httpEndpoint" => @http_endpoint,
    "httpProtocolIpv6" => @http_protocol_ipv6,
    "httpPutResponseHopLimit" => @http_put_response_hop_limit,
    "httpTokens" => @http_tokens,
    "instanceMetadataTags" => @instance_metadata_tags,
  })
  result.compact
end