Class: AWSCDK::OpsWorks::CfnInstanceProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ops_works/cfn_instance_props.rb

Overview

Properties for defining a CfnInstance.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance_type:, layer_ids:, stack_id:, agent_version: nil, ami_id: nil, architecture: nil, auto_scaling_type: nil, availability_zone: nil, block_device_mappings: nil, ebs_optimized: nil, elastic_ips: nil, hostname: nil, install_updates_on_boot: nil, os: nil, root_device_type: nil, ssh_key_name: nil, subnet_id: nil, tenancy: nil, time_based_auto_scaling: nil, virtualization_type: nil, volumes: nil) ⇒ CfnInstanceProps

Returns a new instance of CfnInstanceProps.

Parameters:

  • instance_type (String)

    The instance type, such as t2.micro . For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.

  • layer_ids (Array<String>)

    An array that contains the instance's layer IDs.

  • stack_id (String)

    The stack ID.

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

    The default OpsWorks Stacks agent version. You have the following options:.

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

    A custom AMI ID to be used to create the instance.

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

    The instance architecture.

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

    For load-based or time-based instances, the type.

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

    The Availability Zone of the OpsWorks instance, such as us-east-2a .

  • block_device_mappings (AWSCDK::IResolvable, Array<AWSCDK::IResolvable, AWSCDK::OpsWorks::CfnInstance::BlockDeviceMappingProperty>, nil) (defaults to: nil)

    An array of BlockDeviceMapping objects that specify the instance's block devices.

  • ebs_optimized (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Whether to create an Amazon EBS-optimized instance.

  • elastic_ips (Array<String>, nil) (defaults to: nil)

    A list of Elastic IP addresses to associate with the instance.

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

    The instance host name. The following are character limits for instance host names.

  • install_updates_on_boot (Boolean, AWSCDK::IResolvable, nil) (defaults to: nil)

    Whether to install operating system and package updates when the instance boots.

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

    The instance's operating system, which must be set to one of the following.

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

    The instance root device type.

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

    The instance's Amazon EC2 key-pair name.

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

    The ID of the instance's subnet.

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

    The instance's tenancy option.

  • time_based_auto_scaling (AWSCDK::IResolvable, AWSCDK::OpsWorks::CfnInstance::TimeBasedAutoScalingProperty, nil) (defaults to: nil)

    The time-based scaling configuration for the instance.

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

    The instance's virtualization type, paravirtual or hvm .

  • volumes (Array<String>, nil) (defaults to: nil)

    A list of OpsWorks volume IDs to associate with the instance.



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
# File 'ops_works/cfn_instance_props.rb', line 30

def initialize(instance_type:, layer_ids:, stack_id:, agent_version: nil, ami_id: nil, architecture: nil, auto_scaling_type: nil, availability_zone: nil, block_device_mappings: nil, ebs_optimized: nil, elastic_ips: nil, hostname: nil, install_updates_on_boot: nil, os: nil, root_device_type: nil, ssh_key_name: nil, subnet_id: nil, tenancy: nil, time_based_auto_scaling: nil, virtualization_type: nil, volumes: nil)
  @instance_type = instance_type
  Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "instanceType")
  @layer_ids = layer_ids
  Jsii::Type.check_type(@layer_ids, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "layerIds")
  @stack_id = stack_id
  Jsii::Type.check_type(@stack_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "stackId")
  @agent_version = agent_version
  Jsii::Type.check_type(@agent_version, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "agentVersion") unless @agent_version.nil?
  @ami_id = ami_id
  Jsii::Type.check_type(@ami_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "amiId") unless @ami_id.nil?
  @architecture = architecture
  Jsii::Type.check_type(@architecture, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "architecture") unless @architecture.nil?
  @auto_scaling_type = auto_scaling_type
  Jsii::Type.check_type(@auto_scaling_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "autoScalingType") unless @auto_scaling_type.nil?
  @availability_zone = availability_zone
  Jsii::Type.check_type(@availability_zone, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "availabilityZone") unless @availability_zone.nil?
  @block_device_mappings = block_device_mappings
  Jsii::Type.check_type(@block_device_mappings, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfb3Bzd29ya3MuQ2ZuSW5zdGFuY2UuQmxvY2tEZXZpY2VNYXBwaW5nUHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "blockDeviceMappings") unless @block_device_mappings.nil?
  @ebs_optimized = ebs_optimized
  Jsii::Type.check_type(@ebs_optimized, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "ebsOptimized") unless @ebs_optimized.nil?
  @elastic_ips = elastic_ips
  Jsii::Type.check_type(@elastic_ips, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "elasticIps") unless @elastic_ips.nil?
  @hostname = hostname
  Jsii::Type.check_type(@hostname, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hostname") unless @hostname.nil?
  @install_updates_on_boot = install_updates_on_boot
  Jsii::Type.check_type(@install_updates_on_boot, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "installUpdatesOnBoot") unless @install_updates_on_boot.nil?
  @os = os
  Jsii::Type.check_type(@os, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "os") unless @os.nil?
  @root_device_type = root_device_type
  Jsii::Type.check_type(@root_device_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rootDeviceType") unless @root_device_type.nil?
  @ssh_key_name = ssh_key_name
  Jsii::Type.check_type(@ssh_key_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sshKeyName") unless @ssh_key_name.nil?
  @subnet_id = subnet_id
  Jsii::Type.check_type(@subnet_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "subnetId") unless @subnet_id.nil?
  @tenancy = tenancy
  Jsii::Type.check_type(@tenancy, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tenancy") unless @tenancy.nil?
  @time_based_auto_scaling = time_based_auto_scaling.is_a?(Hash) ? ::AWSCDK::OpsWorks::CfnInstance::TimeBasedAutoScalingProperty.new(**time_based_auto_scaling.transform_keys(&:to_sym)) : time_based_auto_scaling
  Jsii::Type.check_type(@time_based_auto_scaling, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19vcHN3b3Jrcy5DZm5JbnN0YW5jZS5UaW1lQmFzZWRBdXRvU2NhbGluZ1Byb3BlcnR5In1dfX0=")), "timeBasedAutoScaling") unless @time_based_auto_scaling.nil?
  @virtualization_type = virtualization_type
  Jsii::Type.check_type(@virtualization_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "virtualizationType") unless @virtualization_type.nil?
  @volumes = volumes
  Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "volumes") unless @volumes.nil?
end

Instance Attribute Details

#agent_versionString? (readonly)

The default OpsWorks Stacks agent version. You have the following options:.

  • INHERIT - Use the stack's default agent version setting.
  • version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, edit the instance configuration and specify a new version. OpsWorks Stacks installs that version on the instance.

The default setting is INHERIT . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.



99
100
101
# File 'ops_works/cfn_instance_props.rb', line 99

def agent_version
  @agent_version
end

#ami_idString? (readonly)

A custom AMI ID to be used to create the instance.

The AMI should be based on one of the supported operating systems. For more information, see Using Custom AMIs .

If you specify a custom AMI, you must set Os to Custom .



108
109
110
# File 'ops_works/cfn_instance_props.rb', line 108

def ami_id
  @ami_id
end

#architectureString? (readonly)

The instance architecture.

The default option is x86_64 . Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types .



115
116
117
# File 'ops_works/cfn_instance_props.rb', line 115

def architecture
  @architecture
end

#auto_scaling_typeString? (readonly)

For load-based or time-based instances, the type.

Windows stacks can use only time-based instances.



122
123
124
# File 'ops_works/cfn_instance_props.rb', line 122

def auto_scaling_type
  @auto_scaling_type
end

#availability_zoneString? (readonly)

The Availability Zone of the OpsWorks instance, such as us-east-2a .



127
128
129
# File 'ops_works/cfn_instance_props.rb', line 127

def availability_zone
  @availability_zone
end

#block_device_mappingsAWSCDK::IResolvable, ... (readonly)

An array of BlockDeviceMapping objects that specify the instance's block devices.

For more information, see Block Device Mapping . Note that block device mappings are not supported for custom AMIs.



134
135
136
# File 'ops_works/cfn_instance_props.rb', line 134

def block_device_mappings
  @block_device_mappings
end

#ebs_optimizedBoolean, ... (readonly)

Whether to create an Amazon EBS-optimized instance.



139
140
141
# File 'ops_works/cfn_instance_props.rb', line 139

def ebs_optimized
  @ebs_optimized
end

#elastic_ipsArray<String>? (readonly)

A list of Elastic IP addresses to associate with the instance.



144
145
146
# File 'ops_works/cfn_instance_props.rb', line 144

def elastic_ips
  @elastic_ips
end

#hostnameString? (readonly)

The instance host name. The following are character limits for instance host names.

  • Linux-based instances: 63 characters
  • Windows-based instances: 15 characters


152
153
154
# File 'ops_works/cfn_instance_props.rb', line 152

def hostname
  @hostname
end

#install_updates_on_bootBoolean, ... (readonly)

Whether to install operating system and package updates when the instance boots.

The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.

We strongly recommend using the default value of true to ensure that your instances have the latest security updates.



161
162
163
# File 'ops_works/cfn_instance_props.rb', line 161

def install_updates_on_boot
  @install_updates_on_boot
end

#instance_typeString (readonly)

The instance type, such as t2.micro . For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.



79
80
81
# File 'ops_works/cfn_instance_props.rb', line 79

def instance_type
  @instance_type
end

#layer_idsArray<String> (readonly)

An array that contains the instance's layer IDs.



84
85
86
# File 'ops_works/cfn_instance_props.rb', line 84

def layer_ids
  @layer_ids
end

#osString? (readonly)

The instance's operating system, which must be set to one of the following.

  • A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2 , Amazon Linux 2018.03 , Amazon Linux 2017.09 , Amazon Linux 2017.03 , Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
  • A supported Ubuntu operating system, such as Ubuntu 18.04 LTS , Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
  • CentOS Linux 7
  • Red Hat Enterprise Linux 7
  • A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
  • A custom AMI: Custom .

Not all operating systems are supported with all versions of Chef. For more information about the supported operating systems, see OpsWorks Stacks Operating Systems .

The default option is the current Amazon Linux version. If you set this parameter to Custom , you must use the CreateInstance action's AmiId parameter to specify the custom AMI that you want to use. Block device mappings are not supported if the value is Custom . For more information about how to use custom AMIs with OpsWorks Stacks, see Using Custom AMIs .



177
178
179
# File 'ops_works/cfn_instance_props.rb', line 177

def os
  @os
end

#root_device_typeString? (readonly)

The instance root device type.

For more information, see Storage for the Root Device .



184
185
186
# File 'ops_works/cfn_instance_props.rb', line 184

def root_device_type
  @root_device_type
end

#ssh_key_nameString? (readonly)

The instance's Amazon EC2 key-pair name.



189
190
191
# File 'ops_works/cfn_instance_props.rb', line 189

def ssh_key_name
  @ssh_key_name
end

#stack_idString (readonly)

The stack ID.



89
90
91
# File 'ops_works/cfn_instance_props.rb', line 89

def stack_id
  @stack_id
end

#subnet_idString? (readonly)

The ID of the instance's subnet.

If the stack is running in a VPC, you can use this parameter to override the stack's default subnet ID value and direct OpsWorks Stacks to launch the instance in a different subnet.



196
197
198
# File 'ops_works/cfn_instance_props.rb', line 196

def subnet_id
  @subnet_id
end

#tenancyString? (readonly)

The instance's tenancy option.

The default option is no tenancy, or if the instance is running in a VPC, inherit tenancy settings from the VPC. The following are valid values for this parameter: dedicated , default , or host . Because there are costs associated with changes in tenancy options, we recommend that you research tenancy options before choosing them for your instances. For more information about dedicated hosts, see Dedicated Hosts Overview and Amazon EC2 Dedicated Hosts . For more information about dedicated instances, see Dedicated Instances and Amazon EC2 Dedicated Instances .



203
204
205
# File 'ops_works/cfn_instance_props.rb', line 203

def tenancy
  @tenancy
end

#time_based_auto_scalingAWSCDK::IResolvable, ... (readonly)

The time-based scaling configuration for the instance.



208
209
210
# File 'ops_works/cfn_instance_props.rb', line 208

def time_based_auto_scaling
  @time_based_auto_scaling
end

#virtualization_typeString? (readonly)

The instance's virtualization type, paravirtual or hvm .



213
214
215
# File 'ops_works/cfn_instance_props.rb', line 213

def virtualization_type
  @virtualization_type
end

#volumesArray<String>? (readonly)

A list of OpsWorks volume IDs to associate with the instance.

For more information, see AWS::OpsWorks::Volume .



220
221
222
# File 'ops_works/cfn_instance_props.rb', line 220

def volumes
  @volumes
end

Class Method Details

.jsii_propertiesObject



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'ops_works/cfn_instance_props.rb', line 222

def self.jsii_properties
  {
    :instance_type => "instanceType",
    :layer_ids => "layerIds",
    :stack_id => "stackId",
    :agent_version => "agentVersion",
    :ami_id => "amiId",
    :architecture => "architecture",
    :auto_scaling_type => "autoScalingType",
    :availability_zone => "availabilityZone",
    :block_device_mappings => "blockDeviceMappings",
    :ebs_optimized => "ebsOptimized",
    :elastic_ips => "elasticIps",
    :hostname => "hostname",
    :install_updates_on_boot => "installUpdatesOnBoot",
    :os => "os",
    :root_device_type => "rootDeviceType",
    :ssh_key_name => "sshKeyName",
    :subnet_id => "subnetId",
    :tenancy => "tenancy",
    :time_based_auto_scaling => "timeBasedAutoScaling",
    :virtualization_type => "virtualizationType",
    :volumes => "volumes",
  }
end

Instance Method Details

#to_jsiiObject



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'ops_works/cfn_instance_props.rb', line 248

def to_jsii
  result = {}
  result.merge!({
    "instanceType" => @instance_type,
    "layerIds" => @layer_ids,
    "stackId" => @stack_id,
    "agentVersion" => @agent_version,
    "amiId" => @ami_id,
    "architecture" => @architecture,
    "autoScalingType" => @auto_scaling_type,
    "availabilityZone" => @availability_zone,
    "blockDeviceMappings" => @block_device_mappings,
    "ebsOptimized" => @ebs_optimized,
    "elasticIps" => @elastic_ips,
    "hostname" => @hostname,
    "installUpdatesOnBoot" => @install_updates_on_boot,
    "os" => @os,
    "rootDeviceType" => @root_device_type,
    "sshKeyName" => @ssh_key_name,
    "subnetId" => @subnet_id,
    "tenancy" => @tenancy,
    "timeBasedAutoScaling" => @time_based_auto_scaling,
    "virtualizationType" => @virtualization_type,
    "volumes" => @volumes,
  })
  result.compact
end