Class: AWSCDK::EC2::CfnInstance

Inherits:
CfnResource
  • Object
show all
Includes:
IInspectable, ITaggable, Interfaces::AWSEC2::IInstanceRef
Defined in:
ec2/cfn_instance.rb

Overview

Specifies an EC2 instance.

If an Elastic IP address is attached to your instance, AWS CloudFormation reattaches the Elastic IP address after it updates the instance. For more information about updating stacks, see AWS CloudFormation Stacks Updates .

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props = nil) ⇒ CfnInstance

Create a new AWS::EC2::Instance.

Parameters:

  • scope (Constructs::Construct)

    Scope in which this resource is defined.

  • id (String)

    Construct identifier for this resource (unique in its scope).

  • props (AWSCDK::EC2::CfnInstanceProps, nil) (defaults to: nil)

    Resource properties.



20
21
22
23
24
25
26
# File 'ec2/cfn_instance.rb', line 20

def initialize(scope, id, props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstanceProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlUHJvcHMifQ==")), "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.arn_for_instance(resource) ⇒ String

Parameters:

Returns:

  • (String)


121
122
123
124
# File 'ec2/cfn_instance.rb', line 121

def self.arn_for_instance(resource)
  Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19lYzIuSUluc3RhbmNlUmVmIn0=")), "resource")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.CfnInstance", "arnForInstance", [resource])
end

.CFN_RESOURCE_TYPE_NAMEString

The CloudFormation resource type name for this resource class.

Returns:

  • (String)


241
242
243
# File 'ec2/cfn_instance.rb', line 241

def self.CFN_RESOURCE_TYPE_NAME()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.CfnInstance", "CFN_RESOURCE_TYPE_NAME")
end

.from_instance_id(scope, id, instance_id) ⇒ AWSCDK::Interfaces::AWSEC2::IInstanceRef

Creates a new IInstanceRef from a instanceId.

Parameters:

  • scope (Constructs::Construct)
  • id (String)
  • instance_id (String)

Returns:



132
133
134
135
136
137
# File 'ec2/cfn_instance.rb', line 132

def self.from_instance_id(scope, id, instance_id)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(instance_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceId")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.CfnInstance", "fromInstanceId", [scope, id, instance_id])
end

.is_cfn_instance(x) ⇒ Boolean

Checks whether the given object is a CfnInstance.

Parameters:

  • x (Object)

Returns:

  • (Boolean)


143
144
145
146
# File 'ec2/cfn_instance.rb', line 143

def self.is_cfn_instance(x)
  Jsii::Type.check_type(x, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "x")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.CfnInstance", "isCfnInstance", [x])
end

.jsii_overridable_methodsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
# File 'ec2/cfn_instance.rb', line 28

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :creation_stack => { kind: :property, name: "creationStack", is_optional: false },
    :logical_id => { kind: :property, name: "logicalId", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :ref => { kind: :property, name: "ref", is_optional: false },
    :cfn_options => { kind: :property, name: "cfnOptions", is_optional: false },
    :cfn_properties => { kind: :property, name: "cfnProperties", is_optional: false },
    :cfn_property_names => { kind: :property, name: "cfnPropertyNames", is_optional: false },
    :cfn_resource_type => { kind: :property, name: "cfnResourceType", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :updated_properites => { kind: :property, name: "updatedProperites", is_optional: false },
    :updated_properties => { kind: :property, name: "updatedProperties", is_optional: false },
    :attr_availability_zone => { kind: :property, name: "attrAvailabilityZone", is_optional: false },
    :attr_instance_id => { kind: :property, name: "attrInstanceId", is_optional: false },
    :attr_private_dns_name => { kind: :property, name: "attrPrivateDnsName", is_optional: false },
    :attr_private_ip => { kind: :property, name: "attrPrivateIp", is_optional: false },
    :attr_public_dns_name => { kind: :property, name: "attrPublicDnsName", is_optional: false },
    :attr_public_ip => { kind: :property, name: "attrPublicIp", is_optional: false },
    :attr_state => { kind: :property, name: "attrState", is_optional: false },
    :attr_vpc_id => { kind: :property, name: "attrVpcId", is_optional: false },
    :instance_ref => { kind: :property, name: "instanceRef", is_optional: false },
    :tags => { kind: :property, name: "tags", is_optional: false },
    :additional_info => { kind: :property, name: "additionalInfo", is_optional: true },
    :affinity => { kind: :property, name: "affinity", is_optional: true },
    :availability_zone => { kind: :property, name: "availabilityZone", is_optional: true },
    :block_device_mappings => { kind: :property, name: "blockDeviceMappings", is_optional: true },
    :cpu_options => { kind: :property, name: "cpuOptions", is_optional: true },
    :credit_specification => { kind: :property, name: "creditSpecification", is_optional: true },
    :disable_api_termination => { kind: :property, name: "disableApiTermination", is_optional: true },
    :ebs_optimized => { kind: :property, name: "ebsOptimized", is_optional: true },
    :elastic_gpu_specifications => { kind: :property, name: "elasticGpuSpecifications", is_optional: true },
    :elastic_inference_accelerators => { kind: :property, name: "elasticInferenceAccelerators", is_optional: true },
    :enclave_options => { kind: :property, name: "enclaveOptions", is_optional: true },
    :hibernation_options => { kind: :property, name: "hibernationOptions", is_optional: true },
    :host_id => { kind: :property, name: "hostId", is_optional: true },
    :host_resource_group_arn => { kind: :property, name: "hostResourceGroupArn", is_optional: true },
    :iam_instance_profile => { kind: :property, name: "iamInstanceProfile", is_optional: true },
    :image_id => { kind: :property, name: "imageId", is_optional: true },
    :instance_initiated_shutdown_behavior => { kind: :property, name: "instanceInitiatedShutdownBehavior", is_optional: true },
    :instance_type => { kind: :property, name: "instanceType", is_optional: true },
    :ipv6_address_count => { kind: :property, name: "ipv6AddressCount", is_optional: true },
    :ipv6_addresses => { kind: :property, name: "ipv6Addresses", is_optional: true },
    :kernel_id => { kind: :property, name: "kernelId", is_optional: true },
    :key_name => { kind: :property, name: "keyName", is_optional: true },
    :launch_template => { kind: :property, name: "launchTemplate", is_optional: true },
    :license_specifications => { kind: :property, name: "licenseSpecifications", is_optional: true },
    :metadata_options => { kind: :property, name: "metadataOptions", is_optional: true },
    :monitoring => { kind: :property, name: "monitoring", is_optional: true },
    :network_interfaces => { kind: :property, name: "networkInterfaces", is_optional: true },
    :placement_group_name => { kind: :property, name: "placementGroupName", is_optional: true },
    :private_dns_name_options => { kind: :property, name: "privateDnsNameOptions", is_optional: true },
    :private_ip_address => { kind: :property, name: "privateIpAddress", is_optional: true },
    :propagate_tags_to_volume_on_creation => { kind: :property, name: "propagateTagsToVolumeOnCreation", is_optional: true },
    :ramdisk_id => { kind: :property, name: "ramdiskId", is_optional: true },
    :security_group_ids => { kind: :property, name: "securityGroupIds", is_optional: true },
    :security_groups => { kind: :property, name: "securityGroups", is_optional: true },
    :source_dest_check => { kind: :property, name: "sourceDestCheck", is_optional: true },
    :ssm_associations => { kind: :property, name: "ssmAssociations", is_optional: true },
    :subnet_id => { kind: :property, name: "subnetId", is_optional: true },
    :tags_raw => { kind: :property, name: "tagsRaw", is_optional: true },
    :tenancy => { kind: :property, name: "tenancy", is_optional: true },
    :user_data => { kind: :property, name: "userData", is_optional: true },
    :volumes => { kind: :property, name: "volumes", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :override_logical_id => { kind: :method, name: "overrideLogicalId", is_optional: false },
    :add_deletion_override => { kind: :method, name: "addDeletionOverride", is_optional: false },
    :add_dependency => { kind: :method, name: "addDependency", is_optional: false },
    :add_depends_on => { kind: :method, name: "addDependsOn", is_optional: false },
    :add_metadata => { kind: :method, name: "addMetadata", is_optional: false },
    :add_override => { kind: :method, name: "addOverride", is_optional: false },
    :add_property_deletion_override => { kind: :method, name: "addPropertyDeletionOverride", is_optional: false },
    :add_property_override => { kind: :method, name: "addPropertyOverride", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :cfn_property_name => { kind: :method, name: "cfnPropertyName", is_optional: false },
    :get_att => { kind: :method, name: "getAtt", is_optional: false },
    :get_metadata => { kind: :method, name: "getMetadata", is_optional: false },
    :obtain_dependencies => { kind: :method, name: "obtainDependencies", is_optional: false },
    :obtain_resource_dependencies => { kind: :method, name: "obtainResourceDependencies", is_optional: false },
    :remove_dependency => { kind: :method, name: "removeDependency", is_optional: false },
    :render_properties => { kind: :method, name: "renderProperties", is_optional: false },
    :replace_dependency => { kind: :method, name: "replaceDependency", is_optional: false },
    :should_synthesize => { kind: :method, name: "shouldSynthesize", is_optional: false },
    :validate_properties => { kind: :method, name: "validateProperties", is_optional: false },
    :inspect => { kind: :method, name: "inspect", is_optional: false },
  }
end

Instance Method Details

#add_deletion_override(path) ⇒ void

This method returns an undefined value.

Syntactic sugar for addOverride(path, undefined).

Parameters:

  • path (String)

    The path of the value to delete.



865
866
867
868
# File 'ec2/cfn_instance.rb', line 865

def add_deletion_override(path)
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path")
  jsii_call_method("addDeletionOverride", [path])
end

#add_dependency(target) ⇒ void

This method returns an undefined value.

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters:



877
878
879
880
# File 'ec2/cfn_instance.rb', line 877

def add_dependency(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  jsii_call_method("addDependency", [target])
end

#add_depends_on(target) ⇒ void

Deprecated.

use addDependency

This method returns an undefined value.

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

Parameters:



887
888
889
890
# File 'ec2/cfn_instance.rb', line 887

def add_depends_on(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  jsii_call_method("addDependsOn", [target])
end

#add_metadata(key, value) ⇒ void

This method returns an undefined value.

Add a value to the CloudFormation Resource Metadata.



898
899
900
901
902
# File 'ec2/cfn_instance.rb', line 898

def (key, value)
  Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  jsii_call_method("addMetadata", [key, value])
end

#add_override(path, value) ⇒ void

This method returns an undefined value.

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use add_property_override or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

# Example automatically generated from non-compiling source. May contain errors.
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides

"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to add_override will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters:

  • path (String)
    • The path of the property, you can use dot notation to override values in complex types.
  • value (Object)
    • The value.


955
956
957
958
959
# File 'ec2/cfn_instance.rb', line 955

def add_override(path, value)
  Jsii::Type.check_type(path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "path")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  jsii_call_method("addOverride", [path, value])
end

#add_property_deletion_override(property_path) ⇒ void

This method returns an undefined value.

Adds an override that deletes the value of a property from the resource definition.

Parameters:

  • property_path (String)

    The path to the property.



965
966
967
968
# File 'ec2/cfn_instance.rb', line 965

def add_property_deletion_override(property_path)
  Jsii::Type.check_type(property_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "propertyPath")
  jsii_call_method("addPropertyDeletionOverride", [property_path])
end

#add_property_override(property_path, value) ⇒ void

This method returns an undefined value.

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters:

  • property_path (String)

    The path of the property.

  • value (Object)

    The value.



977
978
979
980
981
# File 'ec2/cfn_instance.rb', line 977

def add_property_override(property_path, value)
  Jsii::Type.check_type(property_path, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "propertyPath")
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "value")
  jsii_call_method("addPropertyOverride", [property_path, value])
end

#additional_infoString?

This property is reserved for internal use.

Returns:

  • (String, nil)


324
325
326
# File 'ec2/cfn_instance.rb', line 324

def additional_info()
  jsii_get_property("additionalInfo")
end

#additional_info=(value) ⇒ Object



328
329
330
331
# File 'ec2/cfn_instance.rb', line 328

def additional_info=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "additionalInfo") unless value.nil?
  jsii_set_property("additionalInfo", value)
end

#affinityString?

Indicates whether the instance is associated with a dedicated host.

Returns:

  • (String, nil)


336
337
338
# File 'ec2/cfn_instance.rb', line 336

def affinity()
  jsii_get_property("affinity")
end

#affinity=(value) ⇒ Object



340
341
342
343
# File 'ec2/cfn_instance.rb', line 340

def affinity=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "affinity") unless value.nil?
  jsii_set_property("affinity", value)
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Sets the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.

Parameters:



990
991
992
993
# File 'ec2/cfn_instance.rb', line 990

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy = nil, options = nil) ⇒ void

This method returns an undefined value.

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:



1012
1013
1014
1015
1016
1017
# File 'ec2/cfn_instance.rb', line 1012

def apply_removal_policy(policy = nil, options = nil)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy") unless policy.nil?
  options = options.is_a?(Hash) ? ::AWSCDK::RemovalPolicyOptions.new(**options.transform_keys(&:to_sym)) : options
  Jsii::Type.check_type(options, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5T3B0aW9ucyJ9")), "options") unless options.nil?
  jsii_call_method("applyRemovalPolicy", [policy, options])
end

#attr_availability_zoneString

Returns:

  • (String)


246
247
248
# File 'ec2/cfn_instance.rb', line 246

def attr_availability_zone()
  jsii_get_property("attrAvailabilityZone")
end

#attr_instance_idString

The ID of the instance.

Returns:

  • (String)


253
254
255
# File 'ec2/cfn_instance.rb', line 253

def attr_instance_id()
  jsii_get_property("attrInstanceId")
end

#attr_private_dns_nameString

The private DNS name of the specified instance.

For example: ip-10-24-34-0.ec2.internal .

Returns:

  • (String)


262
263
264
# File 'ec2/cfn_instance.rb', line 262

def attr_private_dns_name()
  jsii_get_property("attrPrivateDnsName")
end

#attr_private_ipString

The private IP address of the specified instance.

For example: 10.24.34.0 .

Returns:

  • (String)


271
272
273
# File 'ec2/cfn_instance.rb', line 271

def attr_private_ip()
  jsii_get_property("attrPrivateIp")
end

#attr_public_dns_nameString

The public DNS name of the specified instance.

For example: ec2-107-20-50-45.compute-1.amazonaws.com .

Returns:

  • (String)


280
281
282
# File 'ec2/cfn_instance.rb', line 280

def attr_public_dns_name()
  jsii_get_property("attrPublicDnsName")
end

#attr_public_ipString

The public IP address of the specified instance.

For example: 192.0.2.0 .

Returns:

  • (String)


289
290
291
# File 'ec2/cfn_instance.rb', line 289

def attr_public_ip()
  jsii_get_property("attrPublicIp")
end

#attr_stateAWSCDK::IResolvable

The current state of the instance.

Returns:



296
297
298
# File 'ec2/cfn_instance.rb', line 296

def attr_state()
  jsii_get_property("attrState")
end

#attr_vpc_idString

The ID of the VPC in which the instance is running.

Returns:

  • (String)


303
304
305
# File 'ec2/cfn_instance.rb', line 303

def attr_vpc_id()
  jsii_get_property("attrVpcId")
end

#availability_zoneString?

The Availability Zone of the instance.

Returns:

  • (String, nil)


348
349
350
# File 'ec2/cfn_instance.rb', line 348

def availability_zone()
  jsii_get_property("availabilityZone")
end

#availability_zone=(value) ⇒ Object



352
353
354
355
# File 'ec2/cfn_instance.rb', line 352

def availability_zone=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless value.nil?
  jsii_set_property("availabilityZone", value)
end

#block_device_mappingsAWSCDK::IResolvable, ...

The block device mapping entries that defines the block devices to attach to the instance at launch.



360
361
362
# File 'ec2/cfn_instance.rb', line 360

def block_device_mappings()
  jsii_get_property("blockDeviceMappings")
end

#block_device_mappings=(value) ⇒ Object



364
365
366
367
# File 'ec2/cfn_instance.rb', line 364

def block_device_mappings=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLkJsb2NrRGV2aWNlTWFwcGluZ1Byb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "blockDeviceMappings") unless value.nil?
  jsii_set_property("blockDeviceMappings", value)
end

#cfn_optionsAWSCDK::ICfnResourceOptions

Options for this resource, such as condition, update policy etc.



194
195
196
# File 'ec2/cfn_instance.rb', line 194

def cfn_options()
  jsii_get_property("cfnOptions")
end

#cfn_propertiesHash{String => Object}

Returns:

  • (Hash{String => Object})


199
200
201
# File 'ec2/cfn_instance.rb', line 199

def cfn_properties()
  jsii_get_property("cfnProperties")
end

#cfn_property_name(cdk_property_name) ⇒ String?

Parameters:

  • cdk_property_name (String)

Returns:

  • (String, nil)


1021
1022
1023
1024
# File 'ec2/cfn_instance.rb', line 1021

def cfn_property_name(cdk_property_name)
  Jsii::Type.check_type(cdk_property_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cdkPropertyName")
  jsii_call_method("cfnPropertyName", [cdk_property_name])
end

#cfn_property_namesHash{String => String}

Returns:

  • (Hash{String => String})


204
205
206
# File 'ec2/cfn_instance.rb', line 204

def cfn_property_names()
  jsii_get_property("cfnPropertyNames")
end

#cfn_resource_typeString

AWS resource type.

Returns:

  • (String)


211
212
213
# File 'ec2/cfn_instance.rb', line 211

def cfn_resource_type()
  jsii_get_property("cfnResourceType")
end

#cpu_optionsAWSCDK::IResolvable, ...

The CPU options for the instance.



372
373
374
# File 'ec2/cfn_instance.rb', line 372

def cpu_options()
  jsii_get_property("cpuOptions")
end

#cpu_options=(value) ⇒ Object



376
377
378
379
380
# File 'ec2/cfn_instance.rb', line 376

def cpu_options=(value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::CpuOptionsProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuQ3B1T3B0aW9uc1Byb3BlcnR5In1dfX0=")), "cpuOptions") unless value.nil?
  jsii_set_property("cpuOptions", value)
end

#creation_stackArray<String>

Returns:

  • (Array<String>)


156
157
158
# File 'ec2/cfn_instance.rb', line 156

def creation_stack()
  jsii_get_property("creationStack")
end

#credit_specificationAWSCDK::IResolvable, ...

The credit option for CPU usage of the burstable performance instance.



385
386
387
# File 'ec2/cfn_instance.rb', line 385

def credit_specification()
  jsii_get_property("creditSpecification")
end

#credit_specification=(value) ⇒ Object



389
390
391
392
393
# File 'ec2/cfn_instance.rb', line 389

def credit_specification=(value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::CreditSpecificationProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuQ3JlZGl0U3BlY2lmaWNhdGlvblByb3BlcnR5In1dfX0=")), "creditSpecification") unless value.nil?
  jsii_set_property("creditSpecification", value)
end

#disable_api_terminationBoolean, ...

Indicates whether termination protection is enabled for the instance.

Returns:



398
399
400
# File 'ec2/cfn_instance.rb', line 398

def disable_api_termination()
  jsii_get_property("disableApiTermination")
end

#disable_api_termination=(value) ⇒ Object



402
403
404
405
# File 'ec2/cfn_instance.rb', line 402

def disable_api_termination=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "disableApiTermination") unless value.nil?
  jsii_set_property("disableApiTermination", value)
end

#ebs_optimizedBoolean, ...

Indicates whether the instance is optimized for Amazon EBS I/O.

Returns:



410
411
412
# File 'ec2/cfn_instance.rb', line 410

def ebs_optimized()
  jsii_get_property("ebsOptimized")
end

#ebs_optimized=(value) ⇒ Object



414
415
416
417
# File 'ec2/cfn_instance.rb', line 414

def ebs_optimized=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "ebsOptimized") unless value.nil?
  jsii_set_property("ebsOptimized", value)
end

#elastic_gpu_specificationsAWSCDK::IResolvable, ...

An elastic GPU to associate with the instance.



422
423
424
# File 'ec2/cfn_instance.rb', line 422

def elastic_gpu_specifications()
  jsii_get_property("elasticGpuSpecifications")
end

#elastic_gpu_specifications=(value) ⇒ Object



426
427
428
429
# File 'ec2/cfn_instance.rb', line 426

def elastic_gpu_specifications=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLkVsYXN0aWNHcHVTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "elasticGpuSpecifications") unless value.nil?
  jsii_set_property("elasticGpuSpecifications", value)
end

#elastic_inference_acceleratorsAWSCDK::IResolvable, ...

An elastic inference accelerator to associate with the instance.



434
435
436
# File 'ec2/cfn_instance.rb', line 434

def elastic_inference_accelerators()
  jsii_get_property("elasticInferenceAccelerators")
end

#elastic_inference_accelerators=(value) ⇒ Object



438
439
440
441
# File 'ec2/cfn_instance.rb', line 438

def elastic_inference_accelerators=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLkVsYXN0aWNJbmZlcmVuY2VBY2NlbGVyYXRvclByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "elasticInferenceAccelerators") unless value.nil?
  jsii_set_property("elasticInferenceAccelerators", value)
end

#enclave_optionsAWSCDK::IResolvable, ...

Indicates whether the instance is enabled for AWS Nitro Enclaves.



446
447
448
# File 'ec2/cfn_instance.rb', line 446

def enclave_options()
  jsii_get_property("enclaveOptions")
end

#enclave_options=(value) ⇒ Object



450
451
452
453
454
# File 'ec2/cfn_instance.rb', line 450

def enclave_options=(value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::EnclaveOptionsProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuRW5jbGF2ZU9wdGlvbnNQcm9wZXJ0eSJ9XX19")), "enclaveOptions") unless value.nil?
  jsii_set_property("enclaveOptions", value)
end

#envAWSCDK::Interfaces::ResourceEnvironment



216
217
218
# File 'ec2/cfn_instance.rb', line 216

def env()
  jsii_get_property("env")
end

#get_att(attribute_name, type_hint = nil) ⇒ AWSCDK::Reference

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters:

Returns:



1034
1035
1036
1037
1038
# File 'ec2/cfn_instance.rb', line 1034

def get_att(attribute_name, type_hint = nil)
  Jsii::Type.check_type(attribute_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "attributeName")
  Jsii::Type.check_type(type_hint, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZXNvbHV0aW9uVHlwZUhpbnQifQ==")), "typeHint") unless type_hint.nil?
  jsii_call_method("getAtt", [attribute_name, type_hint])
end

#get_metadata(key) ⇒ Object

Retrieve a value value from the CloudFormation Resource Metadata.



1045
1046
1047
1048
# File 'ec2/cfn_instance.rb', line 1045

def (key)
  Jsii::Type.check_type(key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key")
  jsii_call_method("getMetadata", [key])
end

#hibernation_optionsAWSCDK::IResolvable, ...

Indicates whether an instance is enabled for hibernation.



459
460
461
# File 'ec2/cfn_instance.rb', line 459

def hibernation_options()
  jsii_get_property("hibernationOptions")
end

#hibernation_options=(value) ⇒ Object



463
464
465
466
467
# File 'ec2/cfn_instance.rb', line 463

def hibernation_options=(value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::HibernationOptionsProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuSGliZXJuYXRpb25PcHRpb25zUHJvcGVydHkifV19fQ==")), "hibernationOptions") unless value.nil?
  jsii_set_property("hibernationOptions", value)
end

#host_idString?

If you specify host for the Affinity property, the ID of a dedicated host that the instance is associated with.

Returns:

  • (String, nil)


472
473
474
# File 'ec2/cfn_instance.rb', line 472

def host_id()
  jsii_get_property("hostId")
end

#host_id=(value) ⇒ Object



476
477
478
479
# File 'ec2/cfn_instance.rb', line 476

def host_id=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hostId") unless value.nil?
  jsii_set_property("hostId", value)
end

#host_resource_group_arnString?

The ARN of the host resource group in which to launch the instances.

Returns:

  • (String, nil)


484
485
486
# File 'ec2/cfn_instance.rb', line 484

def host_resource_group_arn()
  jsii_get_property("hostResourceGroupArn")
end

#host_resource_group_arn=(value) ⇒ Object



488
489
490
491
# File 'ec2/cfn_instance.rb', line 488

def host_resource_group_arn=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hostResourceGroupArn") unless value.nil?
  jsii_set_property("hostResourceGroupArn", value)
end

#iam_instance_profileString?

The name of an IAM instance profile.

Returns:

  • (String, nil)


496
497
498
# File 'ec2/cfn_instance.rb', line 496

def iam_instance_profile()
  jsii_get_property("iamInstanceProfile")
end

#iam_instance_profile=(value) ⇒ Object



500
501
502
503
# File 'ec2/cfn_instance.rb', line 500

def iam_instance_profile=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "iamInstanceProfile") unless value.nil?
  jsii_set_property("iamInstanceProfile", value)
end

#image_idString?

The ID of the AMI.

Returns:

  • (String, nil)


508
509
510
# File 'ec2/cfn_instance.rb', line 508

def image_id()
  jsii_get_property("imageId")
end

#image_id=(value) ⇒ Object



512
513
514
515
# File 'ec2/cfn_instance.rb', line 512

def image_id=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "imageId") unless value.nil?
  jsii_set_property("imageId", value)
end

#inspect(inspector) ⇒ void

This method returns an undefined value.

Examines the CloudFormation resource and discloses attributes.

Parameters:



1115
1116
1117
1118
# File 'ec2/cfn_instance.rb', line 1115

def inspect(inspector)
  Jsii::Type.check_type(inspector, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5UcmVlSW5zcGVjdG9yIn0=")), "inspector")
  jsii_call_method("inspect", [inspector])
end

#instance_initiated_shutdown_behaviorString?

Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).

Returns:

  • (String, nil)


520
521
522
# File 'ec2/cfn_instance.rb', line 520

def instance_initiated_shutdown_behavior()
  jsii_get_property("instanceInitiatedShutdownBehavior")
end

#instance_initiated_shutdown_behavior=(value) ⇒ Object



524
525
526
527
# File 'ec2/cfn_instance.rb', line 524

def instance_initiated_shutdown_behavior=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceInitiatedShutdownBehavior") unless value.nil?
  jsii_set_property("instanceInitiatedShutdownBehavior", value)
end

#instance_refAWSCDK::Interfaces::AWSEC2::InstanceReference

A reference to a Instance resource.



310
311
312
# File 'ec2/cfn_instance.rb', line 310

def instance_ref()
  jsii_get_property("instanceRef")
end

#instance_typeString?

The instance type.

For more information, see Instance types in the Amazon EC2 User Guide .

Returns:

  • (String, nil)


534
535
536
# File 'ec2/cfn_instance.rb', line 534

def instance_type()
  jsii_get_property("instanceType")
end

#instance_type=(value) ⇒ Object



538
539
540
541
# File 'ec2/cfn_instance.rb', line 538

def instance_type=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceType") unless value.nil?
  jsii_set_property("instanceType", value)
end

#ipv6_address_countNumeric?

The number of IPv6 addresses to associate with the primary network interface.

Returns:

  • (Numeric, nil)


546
547
548
# File 'ec2/cfn_instance.rb', line 546

def ipv6_address_count()
  jsii_get_property("ipv6AddressCount")
end

#ipv6_address_count=(value) ⇒ Object



550
551
552
553
# File 'ec2/cfn_instance.rb', line 550

def ipv6_address_count=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ipv6AddressCount") unless value.nil?
  jsii_set_property("ipv6AddressCount", value)
end

#ipv6_addressesAWSCDK::IResolvable, ...

The IPv6 addresses from the range of the subnet to associate with the primary network interface.



558
559
560
# File 'ec2/cfn_instance.rb', line 558

def ipv6_addresses()
  jsii_get_property("ipv6Addresses")
end

#ipv6_addresses=(value) ⇒ Object



562
563
564
565
# File 'ec2/cfn_instance.rb', line 562

def ipv6_addresses=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLkluc3RhbmNlSXB2NkFkZHJlc3NQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "ipv6Addresses") unless value.nil?
  jsii_set_property("ipv6Addresses", value)
end

#kernel_idString?

The ID of the kernel.

Returns:

  • (String, nil)


570
571
572
# File 'ec2/cfn_instance.rb', line 570

def kernel_id()
  jsii_get_property("kernelId")
end

#kernel_id=(value) ⇒ Object



574
575
576
577
# File 'ec2/cfn_instance.rb', line 574

def kernel_id=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "kernelId") unless value.nil?
  jsii_set_property("kernelId", value)
end

#key_nameString?

The name of the key pair.

For more information, see Create a key pair for your EC2 instance .

Returns:

  • (String, nil)


584
585
586
# File 'ec2/cfn_instance.rb', line 584

def key_name()
  jsii_get_property("keyName")
end

#key_name=(value) ⇒ Object



588
589
590
591
# File 'ec2/cfn_instance.rb', line 588

def key_name=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "keyName") unless value.nil?
  jsii_set_property("keyName", value)
end

#launch_templateAWSCDK::IResolvable, ...

The launch template.



596
597
598
# File 'ec2/cfn_instance.rb', line 596

def launch_template()
  jsii_get_property("launchTemplate")
end

#launch_template=(value) ⇒ Object



600
601
602
603
604
# File 'ec2/cfn_instance.rb', line 600

def launch_template=(value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::LaunchTemplateSpecificationProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuTGF1bmNoVGVtcGxhdGVTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fQ==")), "launchTemplate") unless value.nil?
  jsii_set_property("launchTemplate", value)
end

#license_specificationsAWSCDK::IResolvable, ...

The license configurations.



609
610
611
# File 'ec2/cfn_instance.rb', line 609

def license_specifications()
  jsii_get_property("licenseSpecifications")
end

#license_specifications=(value) ⇒ Object



613
614
615
616
# File 'ec2/cfn_instance.rb', line 613

def license_specifications=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLkxpY2Vuc2VTcGVjaWZpY2F0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "licenseSpecifications") unless value.nil?
  jsii_set_property("licenseSpecifications", value)
end

#logical_idString

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use override_logical_id(new_logical_id).

Returns:

  • (String)


168
169
170
# File 'ec2/cfn_instance.rb', line 168

def logical_id()
  jsii_get_property("logicalId")
end

#metadata_optionsAWSCDK::IResolvable, ...

The metadata options for the instance.



621
622
623
# File 'ec2/cfn_instance.rb', line 621

def ()
  jsii_get_property("metadataOptions")
end

#metadata_options=(value) ⇒ Object



625
626
627
628
629
# File 'ec2/cfn_instance.rb', line 625

def (value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::MetadataOptionsProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuTWV0YWRhdGFPcHRpb25zUHJvcGVydHkifV19fQ==")), "metadataOptions") unless value.nil?
  jsii_set_property("metadataOptions", value)
end

#monitoringBoolean, ...

Specifies whether detailed monitoring is enabled for the instance.

Returns:



634
635
636
# File 'ec2/cfn_instance.rb', line 634

def monitoring()
  jsii_get_property("monitoring")
end

#monitoring=(value) ⇒ Object



638
639
640
641
# File 'ec2/cfn_instance.rb', line 638

def monitoring=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "monitoring") unless value.nil?
  jsii_set_property("monitoring", value)
end

#network_interfacesAWSCDK::IResolvable, ...

The network interfaces to associate with the instance.



646
647
648
# File 'ec2/cfn_instance.rb', line 646

def network_interfaces()
  jsii_get_property("networkInterfaces")
end

#network_interfaces=(value) ⇒ Object



650
651
652
653
# File 'ec2/cfn_instance.rb', line 650

def network_interfaces=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLk5ldHdvcmtJbnRlcmZhY2VQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "networkInterfaces") unless value.nil?
  jsii_set_property("networkInterfaces", value)
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


151
152
153
# File 'ec2/cfn_instance.rb', line 151

def node()
  jsii_get_property("node")
end

#obtain_dependenciesArray<AWSCDK::CfnResource, AWSCDK::Stack>

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.

Returns:



1056
1057
1058
# File 'ec2/cfn_instance.rb', line 1056

def obtain_dependencies()
  jsii_call_method("obtainDependencies", [])
end

#obtain_resource_dependenciesArray<AWSCDK::CfnResource>

Get a shallow copy of dependencies between this resource and other resources in the same stack.

Returns:



1063
1064
1065
# File 'ec2/cfn_instance.rb', line 1063

def obtain_resource_dependencies()
  jsii_call_method("obtainResourceDependencies", [])
end

#override_logical_id(new_logical_id) ⇒ void

This method returns an undefined value.

Overrides the auto-generated logical ID with a specific ID.

Parameters:

  • new_logical_id (String)

    The new logical ID to use for this stack element.



856
857
858
859
# File 'ec2/cfn_instance.rb', line 856

def override_logical_id(new_logical_id)
  Jsii::Type.check_type(new_logical_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "newLogicalId")
  jsii_call_method("overrideLogicalId", [new_logical_id])
end

#placement_group_nameString?

The name of an existing placement group that you want to launch the instance into (cluster | partition | spread).

Returns:

  • (String, nil)


658
659
660
# File 'ec2/cfn_instance.rb', line 658

def placement_group_name()
  jsii_get_property("placementGroupName")
end

#placement_group_name=(value) ⇒ Object



662
663
664
665
# File 'ec2/cfn_instance.rb', line 662

def placement_group_name=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "placementGroupName") unless value.nil?
  jsii_set_property("placementGroupName", value)
end

#private_dns_name_optionsAWSCDK::IResolvable, ...

The options for the instance hostname.



670
671
672
# File 'ec2/cfn_instance.rb', line 670

def private_dns_name_options()
  jsii_get_property("privateDnsNameOptions")
end

#private_dns_name_options=(value) ⇒ Object



674
675
676
677
678
# File 'ec2/cfn_instance.rb', line 674

def private_dns_name_options=(value)
  value = value.is_a?(Hash) ? ::AWSCDK::EC2::CfnInstance::PrivateDNSNameOptionsProperty.new(**value.transform_keys(&:to_sym)) : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuQ2ZuSW5zdGFuY2UuUHJpdmF0ZURuc05hbWVPcHRpb25zUHJvcGVydHkifV19fQ==")), "privateDnsNameOptions") unless value.nil?
  jsii_set_property("privateDnsNameOptions", value)
end

#private_ip_addressString?

The primary IPv4 address.

You must specify a value from the IPv4 address range of the subnet.

Returns:

  • (String, nil)


685
686
687
# File 'ec2/cfn_instance.rb', line 685

def private_ip_address()
  jsii_get_property("privateIpAddress")
end

#private_ip_address=(value) ⇒ Object



689
690
691
692
# File 'ec2/cfn_instance.rb', line 689

def private_ip_address=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "privateIpAddress") unless value.nil?
  jsii_set_property("privateIpAddress", value)
end

#propagate_tags_to_volume_on_creationBoolean, ...

Indicates whether to assign the tags specified in the Tags property to the volumes specified in the BlockDeviceMappings property.

Returns:



697
698
699
# File 'ec2/cfn_instance.rb', line 697

def propagate_tags_to_volume_on_creation()
  jsii_get_property("propagateTagsToVolumeOnCreation")
end

#propagate_tags_to_volume_on_creation=(value) ⇒ Object



701
702
703
704
# File 'ec2/cfn_instance.rb', line 701

def propagate_tags_to_volume_on_creation=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "propagateTagsToVolumeOnCreation") unless value.nil?
  jsii_set_property("propagateTagsToVolumeOnCreation", value)
end

#ramdisk_idString?

The ID of the RAM disk to select.

Returns:

  • (String, nil)


709
710
711
# File 'ec2/cfn_instance.rb', line 709

def ramdisk_id()
  jsii_get_property("ramdiskId")
end

#ramdisk_id=(value) ⇒ Object



713
714
715
716
# File 'ec2/cfn_instance.rb', line 713

def ramdisk_id=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "ramdiskId") unless value.nil?
  jsii_set_property("ramdiskId", value)
end

#refString

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Returns:

  • (String)


187
188
189
# File 'ec2/cfn_instance.rb', line 187

def ref()
  jsii_get_property("ref")
end

#remove_dependency(target) ⇒ void

This method returns an undefined value.

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

Parameters:



1074
1075
1076
1077
# File 'ec2/cfn_instance.rb', line 1074

def remove_dependency(target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  jsii_call_method("removeDependency", [target])
end

#render_properties(props) ⇒ Hash{String => Object}

Parameters:

  • props (Hash{String => Object})

Returns:

  • (Hash{String => Object})


1081
1082
1083
1084
# File 'ec2/cfn_instance.rb', line 1081

def render_properties(props)
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6ImFueSJ9LCJraW5kIjoibWFwIn19")), "props")
  jsii_call_method("renderProperties", [props])
end

#replace_dependency(target, new_target) ⇒ void

This method returns an undefined value.

Replaces one dependency with another.

Parameters:



1091
1092
1093
1094
1095
# File 'ec2/cfn_instance.rb', line 1091

def replace_dependency(target, new_target)
  Jsii::Type.check_type(target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "target")
  Jsii::Type.check_type(new_target, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5DZm5SZXNvdXJjZSJ9")), "newTarget")
  jsii_call_method("replaceDependency", [target, new_target])
end

#security_group_idsArray<String>?

The IDs of the security groups.

Returns:

  • (Array<String>, nil)


721
722
723
# File 'ec2/cfn_instance.rb', line 721

def security_group_ids()
  jsii_get_property("securityGroupIds")
end

#security_group_ids=(value) ⇒ Object



725
726
727
728
# File 'ec2/cfn_instance.rb', line 725

def security_group_ids=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "securityGroupIds") unless value.nil?
  jsii_set_property("securityGroupIds", value)
end

#security_groupsArray<String>?

[Default VPC] The names of the security groups.

For a nondefault VPC, you must use security group IDs instead.

Returns:

  • (Array<String>, nil)


735
736
737
# File 'ec2/cfn_instance.rb', line 735

def security_groups()
  jsii_get_property("securityGroups")
end

#security_groups=(value) ⇒ Object



739
740
741
742
# File 'ec2/cfn_instance.rb', line 739

def security_groups=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "securityGroups") unless value.nil?
  jsii_set_property("securityGroups", value)
end

#should_synthesizeBoolean

Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template.

Returns:

  • (Boolean)

    true if the resource should be included or false is the resource should be omitted.



1100
1101
1102
# File 'ec2/cfn_instance.rb', line 1100

def should_synthesize()
  jsii_call_method("shouldSynthesize", [])
end

#source_dest_checkBoolean, ...

Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.

Returns:



747
748
749
# File 'ec2/cfn_instance.rb', line 747

def source_dest_check()
  jsii_get_property("sourceDestCheck")
end

#source_dest_check=(value) ⇒ Object



751
752
753
754
# File 'ec2/cfn_instance.rb', line 751

def source_dest_check=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "sourceDestCheck") unless value.nil?
  jsii_set_property("sourceDestCheck", value)
end

#ssm_associationsAWSCDK::IResolvable, ...

The SSM document and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see Create an IAM instance profile for Systems Manager in the AWS Systems Manager User Guide .



759
760
761
# File 'ec2/cfn_instance.rb', line 759

def ssm_associations()
  jsii_get_property("ssmAssociations")
end

#ssm_associations=(value) ⇒ Object



763
764
765
766
# File 'ec2/cfn_instance.rb', line 763

def ssm_associations=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLlNzbUFzc29jaWF0aW9uUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "ssmAssociations") unless value.nil?
  jsii_set_property("ssmAssociations", value)
end

#stackAWSCDK::Stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Returns:



177
178
179
# File 'ec2/cfn_instance.rb', line 177

def stack()
  jsii_get_property("stack")
end

#subnet_idString?

The ID of the subnet to launch the instance into.

Returns:

  • (String, nil)


771
772
773
# File 'ec2/cfn_instance.rb', line 771

def subnet_id()
  jsii_get_property("subnetId")
end

#subnet_id=(value) ⇒ Object



775
776
777
778
# File 'ec2/cfn_instance.rb', line 775

def subnet_id=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "subnetId") unless value.nil?
  jsii_set_property("subnetId", value)
end

#tagsAWSCDK::TagManager

Tag Manager which manages the tags for this resource.

Returns:



317
318
319
# File 'ec2/cfn_instance.rb', line 317

def tags()
  jsii_get_property("tags")
end

#tags_rawArray<AWSCDK::CfnTag>?

The tags to add to the instance.

Returns:



783
784
785
# File 'ec2/cfn_instance.rb', line 783

def tags_raw()
  jsii_get_property("tagsRaw")
end

#tags_raw=(value) ⇒ Object



787
788
789
790
791
# File 'ec2/cfn_instance.rb', line 787

def tags_raw=(value)
  value = value.is_a?(Array) ? value.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : value
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tagsRaw") unless value.nil?
  jsii_set_property("tagsRaw", value)
end

#tenancyString?

The tenancy of the instance.

Returns:

  • (String, nil)


796
797
798
# File 'ec2/cfn_instance.rb', line 796

def tenancy()
  jsii_get_property("tenancy")
end

#tenancy=(value) ⇒ Object



800
801
802
803
# File 'ec2/cfn_instance.rb', line 800

def tenancy=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tenancy") unless value.nil?
  jsii_set_property("tenancy", value)
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)

    a string representation of this resource



832
833
834
# File 'ec2/cfn_instance.rb', line 832

def to_string()
  jsii_call_method("toString", [])
end

#updated_properitesHash{String => Object}

Deprecated.

use updatedProperties Return properties modified after initiation Resources that expose mutable properties should override this function to collect and return the properties object for this resource.

Deprecated.

Returns:

  • (Hash{String => Object})


224
225
226
# File 'ec2/cfn_instance.rb', line 224

def updated_properites()
  jsii_get_property("updatedProperites")
end

#updated_propertiesHash{String => Object}

Return properties modified after initiation.

Resources that expose mutable properties should override this function to collect and return the properties object for this resource.

Returns:

  • (Hash{String => Object})


234
235
236
# File 'ec2/cfn_instance.rb', line 234

def updated_properties()
  jsii_get_property("updatedProperties")
end

#user_dataString?

The parameters or scripts to store as user data.

Returns:

  • (String, nil)


808
809
810
# File 'ec2/cfn_instance.rb', line 808

def user_data()
  jsii_get_property("userData")
end

#user_data=(value) ⇒ Object



812
813
814
815
# File 'ec2/cfn_instance.rb', line 812

def user_data=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "userData") unless value.nil?
  jsii_set_property("userData", value)
end

#validate_properties(_properties) ⇒ void

This method returns an undefined value.

Parameters:

  • _properties (Object)


1106
1107
1108
1109
# File 'ec2/cfn_instance.rb', line 1106

def validate_properties(_properties)
  Jsii::Type.check_type(_properties, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJhbnkifQ==")), "_properties")
  jsii_call_method("validateProperties", [_properties])
end

#volumesAWSCDK::IResolvable, ...

The volumes to attach to the instance.



820
821
822
# File 'ec2/cfn_instance.rb', line 820

def volumes()
  jsii_get_property("volumes")
end

#volumes=(value) ⇒ Object



824
825
826
827
# File 'ec2/cfn_instance.rb', line 824

def volumes=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNmbkluc3RhbmNlLlZvbHVtZVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "volumes") unless value.nil?
  jsii_set_property("volumes", value)
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


845
846
847
848
849
850
# File 'ec2/cfn_instance.rb', line 845

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end