Class: AWSCDK::EC2::CfnLaunchTemplate::MetadataOptionsProperty

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

Overview

The metadata options for the instance.

For more information, see Instance metadata and user data in the Amazon EC2 User Guide .

MetadataOptions is a property of AWS::EC2::LaunchTemplate LaunchTemplateData .

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 desired HTTP PUT response hop limit for instance metadata requests.

  • 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.



2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
# File 'ec2/cfn_launch_template.rb', line 2804

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 the parameter is not specified, the default state is enabled .

If you specify a value of disabled , you will not be able to access your instance metadata.



2825
2826
2827
# File 'ec2/cfn_launch_template.rb', line 2825

def http_endpoint
  @http_endpoint
end

#http_protocol_ipv6String? (readonly)

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

Default: disabled



2832
2833
2834
# File 'ec2/cfn_launch_template.rb', line 2832

def http_protocol_ipv6
  @http_protocol_ipv6
end

#http_put_response_hop_limitNumeric? (readonly)

The desired HTTP PUT response hop limit for instance metadata requests.

The larger the number, the further instance metadata requests can travel.

Default: 1

Possible values: Integers from 1 to 64



2843
2844
2845
# File 'ec2/cfn_launch_template.rb', line 2843

def http_put_response_hop_limit
  @http_put_response_hop_limit
end

#http_tokensString? (readonly)

Indicates whether IMDSv2 is required.

  • optional - IMDSv2 is optional. You can choose whether to send a session token in your instance metadata retrieval requests. If you retrieve IAM role credentials without a session token, you receive the IMDSv1 role credentials. If you retrieve IAM role credentials using a valid session token, you receive the IMDSv2 role credentials.
  • required - IMDSv2 is required. You must send a session token in your instance metadata retrieval requests. With this option, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1 credentials are not available.

Default: If the value of ImdsSupport for the Amazon Machine Image (AMI) for your instance is v2.0 , the default is required .



2853
2854
2855
# File 'ec2/cfn_launch_template.rb', line 2853

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 View tags for your EC2 instances using instance metadata .

Default: disabled



2862
2863
2864
# File 'ec2/cfn_launch_template.rb', line 2862

def 
  @instance_metadata_tags
end

Class Method Details

.jsii_propertiesObject



2864
2865
2866
2867
2868
2869
2870
2871
2872
# File 'ec2/cfn_launch_template.rb', line 2864

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



2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
# File 'ec2/cfn_launch_template.rb', line 2874

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