Class: AWSCDK::EC2::InstanceProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::EC2::InstanceProps
- Defined in:
- ec2/instance_props.rb
Overview
Properties of an EC2 Instance.
Instance Attribute Summary collapse
-
#allow_all_ipv6_outbound ⇒ Boolean?
readonly
Whether the instance could initiate IPv6 connections to anywhere by default.
-
#allow_all_outbound ⇒ Boolean?
readonly
Whether the instance could initiate connections to anywhere by default.
-
#associate_public_ip_address ⇒ Boolean?
readonly
Whether to associate a public IP address to the primary network interface attached to this instance.
-
#availability_zone ⇒ String?
readonly
In which AZ to place the instance within the VPC.
-
#block_devices ⇒ Array<AWSCDK::EC2::BlockDevice>?
readonly
Specifies how block devices are exposed to the instance.
-
#credit_specification ⇒ AWSCDK::EC2::CpuCredits?
readonly
Specifying the CPU credit type for burstable EC2 instance types (T2, T3, T3a, etc).
-
#detailed_monitoring ⇒ Boolean?
readonly
Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.
-
#disable_api_termination ⇒ Boolean?
readonly
If true, the instance will not be able to be terminated using the Amazon EC2 console, CLI, or API.
-
#ebs_optimized ⇒ Boolean?
readonly
Indicates whether the instance is optimized for Amazon EBS I/O.
-
#enclave_enabled ⇒ Boolean?
readonly
Whether the instance is enabled for AWS Nitro Enclaves.
-
#hibernation_enabled ⇒ Boolean?
readonly
Whether the instance is enabled for hibernation.
-
#http_endpoint ⇒ Boolean?
readonly
Enables or disables the HTTP metadata endpoint on your instances.
-
#http_protocol_ipv6 ⇒ Boolean?
readonly
Enables or disables the IPv6 endpoint for the instance metadata service.
-
#http_put_response_hop_limit ⇒ Numeric?
readonly
The desired HTTP PUT response hop limit for instance metadata requests.
-
#http_tokens ⇒ AWSCDK::EC2::HttpTokens?
readonly
The state of token usage for your instance metadata requests.
-
#init ⇒ AWSCDK::EC2::CloudFormationInit?
readonly
Apply the given CloudFormation Init configuration to the instance at startup.
-
#init_options ⇒ AWSCDK::EC2::ApplyCloudFormationInitOptions?
readonly
Use the given options for applying CloudFormation Init.
-
#instance_initiated_shutdown_behavior ⇒ AWSCDK::EC2::InstanceInitiatedShutdownBehavior?
readonly
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
-
#instance_metadata_tags ⇒ Boolean?
readonly
Set to enabled to allow access to instance tags from the instance metadata.
-
#instance_name ⇒ String?
readonly
The name of the instance.
-
#instance_profile ⇒ AWSCDK::IAM::IInstanceProfile?
readonly
The instance profile used to pass role information to EC2 instances.
-
#instance_type ⇒ AWSCDK::EC2::InstanceType
readonly
Type of instance to launch.
-
#ipv6_address_count ⇒ Numeric?
readonly
The number of IPv6 addresses to associate with the primary network interface.
- #key_name ⇒ String? readonly deprecated Deprecated.
-
#key_pair ⇒ AWSCDK::EC2::IKeyPair?
readonly
The SSH keypair to grant access to the instance.
-
#machine_image ⇒ AWSCDK::EC2::IMachineImage
readonly
AMI to launch.
-
#placement_group ⇒ AWSCDK::Interfaces::AWSEC2::IPlacementGroupRef?
readonly
The placement group that you want to launch the instance into.
-
#private_ip_address ⇒ String?
readonly
Defines a private IP address to associate with an instance.
-
#propagate_tags_to_volume_on_creation ⇒ Boolean?
readonly
Propagate the EC2 instance tags to the EBS volumes.
-
#require_imdsv2 ⇒ Boolean?
readonly
Whether IMDSv2 should be required on this instance.
-
#resource_signal_timeout ⇒ AWSCDK::Duration?
readonly
The length of time to wait for the resourceSignalCount.
-
#role ⇒ AWSCDK::IAM::IRole?
readonly
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.
-
#security_group ⇒ AWSCDK::EC2::ISecurityGroup?
readonly
Security Group to assign to this instance.
-
#source_dest_check ⇒ Boolean?
readonly
Specifies whether to enable an instance launched in a VPC to perform NAT.
-
#ssm_session_permissions ⇒ Boolean?
readonly
Add SSM session permissions to the instance role.
-
#user_data ⇒ AWSCDK::EC2::UserData?
readonly
Specific UserData to use.
-
#user_data_causes_replacement ⇒ Boolean?
readonly
Changes to the UserData force replacement.
-
#vpc ⇒ AWSCDK::EC2::IVPC
readonly
VPC to launch the instance in.
-
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection?
readonly
Where to place the instance within the VPC.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(instance_type:, machine_image:, vpc:, allow_all_ipv6_outbound: nil, allow_all_outbound: nil, associate_public_ip_address: nil, availability_zone: nil, block_devices: nil, credit_specification: nil, detailed_monitoring: nil, disable_api_termination: nil, ebs_optimized: nil, enclave_enabled: nil, hibernation_enabled: nil, http_endpoint: nil, http_protocol_ipv6: nil, http_put_response_hop_limit: nil, http_tokens: nil, init: nil, init_options: nil, instance_initiated_shutdown_behavior: nil, instance_metadata_tags: nil, instance_name: nil, instance_profile: nil, ipv6_address_count: nil, key_name: nil, key_pair: nil, placement_group: nil, private_ip_address: nil, propagate_tags_to_volume_on_creation: nil, require_imdsv2: nil, resource_signal_timeout: nil, role: nil, security_group: nil, source_dest_check: nil, ssm_session_permissions: nil, user_data: nil, user_data_causes_replacement: nil, vpc_subnets: nil) ⇒ InstanceProps
constructor
A new instance of InstanceProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(instance_type:, machine_image:, vpc:, allow_all_ipv6_outbound: nil, allow_all_outbound: nil, associate_public_ip_address: nil, availability_zone: nil, block_devices: nil, credit_specification: nil, detailed_monitoring: nil, disable_api_termination: nil, ebs_optimized: nil, enclave_enabled: nil, hibernation_enabled: nil, http_endpoint: nil, http_protocol_ipv6: nil, http_put_response_hop_limit: nil, http_tokens: nil, init: nil, init_options: nil, instance_initiated_shutdown_behavior: nil, instance_metadata_tags: nil, instance_name: nil, instance_profile: nil, ipv6_address_count: nil, key_name: nil, key_pair: nil, placement_group: nil, private_ip_address: nil, propagate_tags_to_volume_on_creation: nil, require_imdsv2: nil, resource_signal_timeout: nil, role: nil, security_group: nil, source_dest_check: nil, ssm_session_permissions: nil, user_data: nil, user_data_causes_replacement: nil, vpc_subnets: nil) ⇒ InstanceProps
Returns a new instance of InstanceProps.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'ec2/instance_props.rb', line 46 def initialize(instance_type:, machine_image:, vpc:, allow_all_ipv6_outbound: nil, allow_all_outbound: nil, associate_public_ip_address: nil, availability_zone: nil, block_devices: nil, credit_specification: nil, detailed_monitoring: nil, disable_api_termination: nil, ebs_optimized: nil, enclave_enabled: nil, hibernation_enabled: nil, http_endpoint: nil, http_protocol_ipv6: nil, http_put_response_hop_limit: nil, http_tokens: nil, init: nil, init_options: nil, instance_initiated_shutdown_behavior: nil, instance_metadata_tags: nil, instance_name: nil, instance_profile: nil, ipv6_address_count: nil, key_name: nil, key_pair: nil, placement_group: nil, private_ip_address: nil, propagate_tags_to_volume_on_creation: nil, require_imdsv2: nil, resource_signal_timeout: nil, role: nil, security_group: nil, source_dest_check: nil, ssm_session_permissions: nil, user_data: nil, user_data_causes_replacement: nil, vpc_subnets: nil) @instance_type = instance_type Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlVHlwZSJ9")), "instanceType") @machine_image = machine_image Jsii::Type.check_type(@machine_image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklNYWNoaW5lSW1hZ2UifQ==")), "machineImage") @vpc = vpc Jsii::Type.check_type(@vpc, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklWcGMifQ==")), "vpc") @allow_all_ipv6_outbound = allow_all_ipv6_outbound Jsii::Type.check_type(@allow_all_ipv6_outbound, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowAllIpv6Outbound") unless @allow_all_ipv6_outbound.nil? @allow_all_outbound = allow_all_outbound Jsii::Type.check_type(@allow_all_outbound, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "allowAllOutbound") unless @allow_all_outbound.nil? @associate_public_ip_address = associate_public_ip_address Jsii::Type.check_type(@associate_public_ip_address, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "associatePublicIpAddress") unless @associate_public_ip_address.nil? @availability_zone = availability_zone Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless @availability_zone.nil? @block_devices = block_devices.is_a?(Array) ? block_devices.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::EC2::BlockDevice.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : block_devices Jsii::Type.check_type(@block_devices, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQmxvY2tEZXZpY2UifSwia2luZCI6ImFycmF5In19")), "blockDevices") unless @block_devices.nil? @credit_specification = credit_specification Jsii::Type.check_type(@credit_specification, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNwdUNyZWRpdHMifQ==")), "creditSpecification") unless @credit_specification.nil? @detailed_monitoring = detailed_monitoring Jsii::Type.check_type(@detailed_monitoring, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "detailedMonitoring") unless @detailed_monitoring.nil? @disable_api_termination = disable_api_termination Jsii::Type.check_type(@disable_api_termination, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "disableApiTermination") unless @disable_api_termination.nil? @ebs_optimized = ebs_optimized Jsii::Type.check_type(@ebs_optimized, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ebsOptimized") unless @ebs_optimized.nil? @enclave_enabled = enclave_enabled Jsii::Type.check_type(@enclave_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enclaveEnabled") unless @enclave_enabled.nil? @hibernation_enabled = hibernation_enabled Jsii::Type.check_type(@hibernation_enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "hibernationEnabled") unless @hibernation_enabled.nil? @http_endpoint = http_endpoint Jsii::Type.check_type(@http_endpoint, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "httpEndpoint") unless @http_endpoint.nil? @http_protocol_ipv6 = http_protocol_ipv6 Jsii::Type.check_type(@http_protocol_ipv6, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkh0dHBUb2tlbnMifQ==")), "httpTokens") unless @http_tokens.nil? @init = init Jsii::Type.check_type(@init, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNsb3VkRm9ybWF0aW9uSW5pdCJ9")), "init") unless @init.nil? @init_options = .is_a?(Hash) ? ::AWSCDK::EC2::ApplyCloudFormationInitOptions.new(**.transform_keys(&:to_sym)) : Jsii::Type.check_type(@init_options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkFwcGx5Q2xvdWRGb3JtYXRpb25Jbml0T3B0aW9ucyJ9")), "initOptions") unless @init_options.nil? @instance_initiated_shutdown_behavior = instance_initiated_shutdown_behavior Jsii::Type.check_type(@instance_initiated_shutdown_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlSW5pdGlhdGVkU2h1dGRvd25CZWhhdmlvciJ9")), "instanceInitiatedShutdownBehavior") unless @instance_initiated_shutdown_behavior.nil? @instance_metadata_tags = Jsii::Type.check_type(@instance_metadata_tags, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "instanceMetadataTags") unless @instance_metadata_tags.nil? @instance_name = instance_name Jsii::Type.check_type(@instance_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceName") unless @instance_name.nil? @instance_profile = instance_profile Jsii::Type.check_type(@instance_profile, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklJbnN0YW5jZVByb2ZpbGUifQ==")), "instanceProfile") unless @instance_profile.nil? @ipv6_address_count = ipv6_address_count Jsii::Type.check_type(@ipv6_address_count, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ipv6AddressCount") unless @ipv6_address_count.nil? @key_name = key_name Jsii::Type.check_type(@key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyName") unless @key_name.nil? @key_pair = key_pair Jsii::Type.check_type(@key_pair, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklLZXlQYWlyIn0=")), "keyPair") unless @key_pair.nil? @placement_group = placement_group Jsii::Type.check_type(@placement_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19lYzIuSVBsYWNlbWVudEdyb3VwUmVmIn0=")), "placementGroup") unless @placement_group.nil? @private_ip_address = private_ip_address Jsii::Type.check_type(@private_ip_address, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "privateIpAddress") unless @private_ip_address.nil? @propagate_tags_to_volume_on_creation = Jsii::Type.check_type(@propagate_tags_to_volume_on_creation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "propagateTagsToVolumeOnCreation") unless @propagate_tags_to_volume_on_creation.nil? @require_imdsv2 = require_imdsv2 Jsii::Type.check_type(@require_imdsv2, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "requireImdsv2") unless @require_imdsv2.nil? @resource_signal_timeout = resource_signal_timeout Jsii::Type.check_type(@resource_signal_timeout, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "resourceSignalTimeout") unless @resource_signal_timeout.nil? @role = role Jsii::Type.check_type(@role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "role") unless @role.nil? @security_group = security_group Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil? @source_dest_check = source_dest_check Jsii::Type.check_type(@source_dest_check, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "sourceDestCheck") unless @source_dest_check.nil? @ssm_session_permissions = Jsii::Type.check_type(@ssm_session_permissions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ssmSessionPermissions") unless @ssm_session_permissions.nil? @user_data = user_data Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlVzZXJEYXRhIn0=")), "userData") unless @user_data.nil? @user_data_causes_replacement = user_data_causes_replacement Jsii::Type.check_type(@user_data_causes_replacement, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "userDataCausesReplacement") unless @user_data_causes_replacement.nil? @vpc_subnets = vpc_subnets.is_a?(Hash) ? ::AWSCDK::EC2::SubnetSelection.new(**vpc_subnets.transform_keys(&:to_sym)) : vpc_subnets Jsii::Type.check_type(@vpc_subnets, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlN1Ym5ldFNlbGVjdGlvbiJ9")), "vpcSubnets") unless @vpc_subnets.nil? end |
Instance Attribute Details
#allow_all_ipv6_outbound ⇒ Boolean? (readonly)
Default: false
Whether the instance could initiate IPv6 connections to anywhere by default.
This property is only used when you do not provide a security group.
145 146 147 |
# File 'ec2/instance_props.rb', line 145 def allow_all_ipv6_outbound @allow_all_ipv6_outbound end |
#allow_all_outbound ⇒ Boolean? (readonly)
Default: true
Whether the instance could initiate connections to anywhere by default.
This property is only used when you do not provide a security group.
152 153 154 |
# File 'ec2/instance_props.rb', line 152 def allow_all_outbound @allow_all_outbound end |
#associate_public_ip_address ⇒ Boolean? (readonly)
Default: - public IP address is automatically assigned based on default behavior
Whether to associate a public IP address to the primary network interface attached to this instance.
You cannot specify this property and ipv6_address_count at the same time.
159 160 161 |
# File 'ec2/instance_props.rb', line 159 def associate_public_ip_address @associate_public_ip_address end |
#availability_zone ⇒ String? (readonly)
Default: - Random zone.
In which AZ to place the instance within the VPC.
164 165 166 |
# File 'ec2/instance_props.rb', line 164 def availability_zone @availability_zone end |
#block_devices ⇒ Array<AWSCDK::EC2::BlockDevice>? (readonly)
Default: - Uses the block device mapping of the AMI
Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.
175 176 177 |
# File 'ec2/instance_props.rb', line 175 def block_devices @block_devices end |
#credit_specification ⇒ AWSCDK::EC2::CpuCredits? (readonly)
Default: - T2 instances are standard, while T3, T4g, and T3a instances are unlimited.
Specifying the CPU credit type for burstable EC2 instance types (T2, T3, T3a, etc).
The unlimited CPU credit option is not supported for T3 instances with a dedicated host.
182 183 184 |
# File 'ec2/instance_props.rb', line 182 def credit_specification @credit_specification end |
#detailed_monitoring ⇒ Boolean? (readonly)
Default: - false
Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.
188 189 190 |
# File 'ec2/instance_props.rb', line 188 def detailed_monitoring @detailed_monitoring end |
#disable_api_termination ⇒ Boolean? (readonly)
Default: false
If true, the instance will not be able to be terminated using the Amazon EC2 console, CLI, or API.
To change this attribute after launch, use ModifyInstanceAttribute. Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, you can terminate the instance by running the shutdown command from the instance.
198 199 200 |
# File 'ec2/instance_props.rb', line 198 def disable_api_termination @disable_api_termination end |
#ebs_optimized ⇒ Boolean? (readonly)
Default: false
Indicates whether the instance is optimized for Amazon EBS I/O.
This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.
207 208 209 |
# File 'ec2/instance_props.rb', line 207 def ebs_optimized @ebs_optimized end |
#enclave_enabled ⇒ Boolean? (readonly)
Default: - false
Whether the instance is enabled for AWS Nitro Enclaves.
Nitro Enclaves requires a Nitro-based virtualized parent instance with specific Intel/AMD with at least 4 vCPUs or Graviton with at least 2 vCPUs instance types and Linux/Windows host OS, while the enclave itself supports only Linux OS.
You can't set both enclave_enabled and hibernation_enabled to true on the same instance.
219 220 221 |
# File 'ec2/instance_props.rb', line 219 def enclave_enabled @enclave_enabled end |
#hibernation_enabled ⇒ Boolean? (readonly)
Default: - false
Whether the instance is enabled for hibernation.
You can't set both enclave_enabled and hibernation_enabled to true on the same instance.
227 228 229 |
# File 'ec2/instance_props.rb', line 227 def hibernation_enabled @hibernation_enabled end |
#http_endpoint ⇒ Boolean? (readonly)
Default: true
Enables or disables the HTTP metadata endpoint on your instances.
233 234 235 |
# File 'ec2/instance_props.rb', line 233 def http_endpoint @http_endpoint end |
#http_protocol_ipv6 ⇒ Boolean? (readonly)
Default: false
Enables or disables the IPv6 endpoint for the instance metadata service.
239 240 241 |
# File 'ec2/instance_props.rb', line 239 def http_protocol_ipv6 @http_protocol_ipv6 end |
#http_put_response_hop_limit ⇒ Numeric? (readonly)
Default: - No default value specified by CloudFormation
The desired HTTP PUT response hop limit for instance metadata requests.
The larger the number, the further instance metadata requests can travel.
Possible values: Integers from 1 to 64
249 250 251 |
# File 'ec2/instance_props.rb', line 249 def http_put_response_hop_limit @http_put_response_hop_limit end |
#http_tokens ⇒ AWSCDK::EC2::HttpTokens? (readonly)
Default: - The default is conditional based on the AMI and account-level settings: - If the AMI's ImdsSupport is v2.0 and the account level default is no-preference, the default is HttpTokens.REQUIRED - If the AMI's ImdsSupport is v2.0 and the account level default is V1 or V2, the default is HttpTokens.OPTIONAL - See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence
The state of token usage for your instance metadata requests.
Set to 'required' to enforce IMDSv2. This is equivalent to using requireImdsv2: true,
but allows you to configure other metadata options alongside IMDSv2 enforcement.
258 259 260 |
# File 'ec2/instance_props.rb', line 258 def http_tokens @http_tokens end |
#init ⇒ AWSCDK::EC2::CloudFormationInit? (readonly)
Default: - no CloudFormation init
Apply the given CloudFormation Init configuration to the instance at startup.
263 264 265 |
# File 'ec2/instance_props.rb', line 263 def init @init end |
#init_options ⇒ AWSCDK::EC2::ApplyCloudFormationInitOptions? (readonly)
Default: - default options
Use the given options for applying CloudFormation Init.
Describes the configsets to use and the timeout to wait
270 271 272 |
# File 'ec2/instance_props.rb', line 270 def @init_options end |
#instance_initiated_shutdown_behavior ⇒ AWSCDK::EC2::InstanceInitiatedShutdownBehavior? (readonly)
Default: InstanceInitiatedShutdownBehavior.STOP
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
276 277 278 |
# File 'ec2/instance_props.rb', line 276 def instance_initiated_shutdown_behavior @instance_initiated_shutdown_behavior end |
#instance_metadata_tags ⇒ Boolean? (readonly)
Default: false
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.
284 285 286 |
# File 'ec2/instance_props.rb', line 284 def @instance_metadata_tags end |
#instance_name ⇒ String? (readonly)
Default: - CDK generated name
The name of the instance.
289 290 291 |
# File 'ec2/instance_props.rb', line 289 def instance_name @instance_name end |
#instance_profile ⇒ AWSCDK::IAM::IInstanceProfile? (readonly)
Default: - No instance profile
The instance profile used to pass role information to EC2 instances.
Note: You can provide an instanceProfile or a role, but not both.
296 297 298 |
# File 'ec2/instance_props.rb', line 296 def instance_profile @instance_profile end |
#instance_type ⇒ AWSCDK::EC2::InstanceType (readonly)
Type of instance to launch.
130 131 132 |
# File 'ec2/instance_props.rb', line 130 def instance_type @instance_type end |
#ipv6_address_count ⇒ Numeric? (readonly)
Default: - For instances associated with an IPv6 subnet, use 1; otherwise, use 0.
The number of IPv6 addresses to associate with the primary network interface.
Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
You cannot specify this property and associate_public_ip_address at the same time.
305 306 307 |
# File 'ec2/instance_props.rb', line 305 def ipv6_address_count @ipv6_address_count end |
#key_name ⇒ String? (readonly)
Default: - No SSH access will be possible.
Name of SSH keypair to grant access to instance.
311 312 313 |
# File 'ec2/instance_props.rb', line 311 def key_name @key_name end |
#key_pair ⇒ AWSCDK::EC2::IKeyPair? (readonly)
Default: - No SSH access will be possible.
The SSH keypair to grant access to the instance.
316 317 318 |
# File 'ec2/instance_props.rb', line 316 def key_pair @key_pair end |
#machine_image ⇒ AWSCDK::EC2::IMachineImage (readonly)
AMI to launch.
134 135 136 |
# File 'ec2/instance_props.rb', line 134 def machine_image @machine_image end |
#placement_group ⇒ AWSCDK::Interfaces::AWSEC2::IPlacementGroupRef? (readonly)
Default: - no placement group will be used for this instance.
The placement group that you want to launch the instance into.
321 322 323 |
# File 'ec2/instance_props.rb', line 321 def placement_group @placement_group end |
#private_ip_address ⇒ String? (readonly)
Default: - no association
Defines a private IP address to associate with an instance.
Private IP should be available within the VPC that the instance is build within.
328 329 330 |
# File 'ec2/instance_props.rb', line 328 def private_ip_address @private_ip_address end |
#propagate_tags_to_volume_on_creation ⇒ Boolean? (readonly)
Default: - false
Propagate the EC2 instance tags to the EBS volumes.
333 334 335 |
# File 'ec2/instance_props.rb', line 333 def @propagate_tags_to_volume_on_creation end |
#require_imdsv2 ⇒ Boolean? (readonly)
Default: - false
Whether IMDSv2 should be required on this instance.
This is a simple boolean flag that enforces IMDSv2 by creating a Launch Template
with httpTokens: 'required'. Use this for straightforward IMDSv2 enforcement.
For more granular control over metadata options (like disabling the metadata endpoint, configuring hop limits, or enabling instance tags), use the individual metadata option properties instead.
344 345 346 |
# File 'ec2/instance_props.rb', line 344 def require_imdsv2 @require_imdsv2 end |
#resource_signal_timeout ⇒ AWSCDK::Duration? (readonly)
Default: Duration.minutes(5)
The length of time to wait for the resourceSignalCount.
The maximum value is 43200 (12 hours).
351 352 353 |
# File 'ec2/instance_props.rb', line 351 def resource_signal_timeout @resource_signal_timeout end |
#role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - A role will automatically be created, it can be accessed via the role property
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.
The role must be assumable by the service principal ec2.amazonaws.com:
Note: You can provide an instanceProfile or a role, but not both.
363 364 365 |
# File 'ec2/instance_props.rb', line 363 def role @role end |
#security_group ⇒ AWSCDK::EC2::ISecurityGroup? (readonly)
Default: - create new security group
Security Group to assign to this instance.
368 369 370 |
# File 'ec2/instance_props.rb', line 368 def security_group @security_group end |
#source_dest_check ⇒ Boolean? (readonly)
Default: true
Specifies whether to enable an instance launched in a VPC to perform NAT.
This controls whether source/destination checking is enabled on the instance. A value of true means that checking is enabled, and false means that checking is disabled. The value must be false for the instance to perform NAT.
377 378 379 |
# File 'ec2/instance_props.rb', line 377 def source_dest_check @source_dest_check end |
#ssm_session_permissions ⇒ Boolean? (readonly)
Default: false
Add SSM session permissions to the instance role.
Setting this to true adds the necessary permissions to connect
to the instance using SSM Session Manager. You can do this
from the AWS Console.
NOTE: Setting this flag to true may not be enough by itself.
You must also use an AMI that comes with the SSM Agent, or install
the SSM Agent yourself. See
Working with SSM Agent
in the SSM Developer Guide.
392 393 394 |
# File 'ec2/instance_props.rb', line 392 def @ssm_session_permissions end |
#user_data ⇒ AWSCDK::EC2::UserData? (readonly)
Default: - A UserData object appropriate for the MachineImage's Operating System is created.
Specific UserData to use.
The UserData may still be mutated after creation.
399 400 401 |
# File 'ec2/instance_props.rb', line 399 def user_data @user_data end |
#user_data_causes_replacement ⇒ Boolean? (readonly)
Default: - true if initOptions is specified, false otherwise.
Changes to the UserData force replacement.
Depending the EC2 instance type, changing UserData either restarts the instance or replaces the instance.
- Instance store-backed instances are replaced.
- EBS-backed instances are restarted.
By default, restarting does not execute the new UserData so you will need a different mechanism to ensure the instance is restarted.
Setting this to true will make the instance's Logical ID depend on the
UserData, which will cause CloudFormation to replace it if the UserData
changes.
417 418 419 |
# File 'ec2/instance_props.rb', line 417 def user_data_causes_replacement @user_data_causes_replacement end |
#vpc ⇒ AWSCDK::EC2::IVPC (readonly)
VPC to launch the instance in.
138 139 140 |
# File 'ec2/instance_props.rb', line 138 def vpc @vpc end |
#vpc_subnets ⇒ AWSCDK::EC2::SubnetSelection? (readonly)
Default: - Private subnets.
Where to place the instance within the VPC.
422 423 424 |
# File 'ec2/instance_props.rb', line 422 def vpc_subnets @vpc_subnets end |
Class Method Details
.jsii_properties ⇒ Object
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'ec2/instance_props.rb', line 424 def self.jsii_properties { :instance_type => "instanceType", :machine_image => "machineImage", :vpc => "vpc", :allow_all_ipv6_outbound => "allowAllIpv6Outbound", :allow_all_outbound => "allowAllOutbound", :associate_public_ip_address => "associatePublicIpAddress", :availability_zone => "availabilityZone", :block_devices => "blockDevices", :credit_specification => "creditSpecification", :detailed_monitoring => "detailedMonitoring", :disable_api_termination => "disableApiTermination", :ebs_optimized => "ebsOptimized", :enclave_enabled => "enclaveEnabled", :hibernation_enabled => "hibernationEnabled", :http_endpoint => "httpEndpoint", :http_protocol_ipv6 => "httpProtocolIpv6", :http_put_response_hop_limit => "httpPutResponseHopLimit", :http_tokens => "httpTokens", :init => "init", :init_options => "initOptions", :instance_initiated_shutdown_behavior => "instanceInitiatedShutdownBehavior", :instance_metadata_tags => "instanceMetadataTags", :instance_name => "instanceName", :instance_profile => "instanceProfile", :ipv6_address_count => "ipv6AddressCount", :key_name => "keyName", :key_pair => "keyPair", :placement_group => "placementGroup", :private_ip_address => "privateIpAddress", :propagate_tags_to_volume_on_creation => "propagateTagsToVolumeOnCreation", :require_imdsv2 => "requireImdsv2", :resource_signal_timeout => "resourceSignalTimeout", :role => "role", :security_group => "securityGroup", :source_dest_check => "sourceDestCheck", :ssm_session_permissions => "ssmSessionPermissions", :user_data => "userData", :user_data_causes_replacement => "userDataCausesReplacement", :vpc_subnets => "vpcSubnets", } end |
Instance Method Details
#to_jsii ⇒ Object
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'ec2/instance_props.rb', line 468 def to_jsii result = {} result.merge!({ "instanceType" => @instance_type, "machineImage" => @machine_image, "vpc" => @vpc, "allowAllIpv6Outbound" => @allow_all_ipv6_outbound, "allowAllOutbound" => @allow_all_outbound, "associatePublicIpAddress" => @associate_public_ip_address, "availabilityZone" => @availability_zone, "blockDevices" => @block_devices, "creditSpecification" => @credit_specification, "detailedMonitoring" => @detailed_monitoring, "disableApiTermination" => @disable_api_termination, "ebsOptimized" => @ebs_optimized, "enclaveEnabled" => @enclave_enabled, "hibernationEnabled" => @hibernation_enabled, "httpEndpoint" => @http_endpoint, "httpProtocolIpv6" => @http_protocol_ipv6, "httpPutResponseHopLimit" => @http_put_response_hop_limit, "httpTokens" => @http_tokens, "init" => @init, "initOptions" => @init_options, "instanceInitiatedShutdownBehavior" => @instance_initiated_shutdown_behavior, "instanceMetadataTags" => @instance_metadata_tags, "instanceName" => @instance_name, "instanceProfile" => @instance_profile, "ipv6AddressCount" => @ipv6_address_count, "keyName" => @key_name, "keyPair" => @key_pair, "placementGroup" => @placement_group, "privateIpAddress" => @private_ip_address, "propagateTagsToVolumeOnCreation" => @propagate_tags_to_volume_on_creation, "requireImdsv2" => @require_imdsv2, "resourceSignalTimeout" => @resource_signal_timeout, "role" => @role, "securityGroup" => @security_group, "sourceDestCheck" => @source_dest_check, "ssmSessionPermissions" => @ssm_session_permissions, "userData" => @user_data, "userDataCausesReplacement" => @user_data_causes_replacement, "vpcSubnets" => @vpc_subnets, }) result.compact end |