Class: AWSCDK::EC2::NatInstanceProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::EC2::NatInstanceProps
- Defined in:
- ec2/nat_instance_props.rb
Overview
Properties for a NAT instance.
Instance Attribute Summary collapse
-
#associate_public_ip_address ⇒ Boolean?
readonly
Whether to associate a public IP address to the primary network interface attached to this instance.
-
#credit_specification ⇒ AWSCDK::EC2::CpuCredits?
readonly
Specifying the CPU credit type for burstable EC2 instance types (T2, T3, T3a, etc).
-
#default_allowed_traffic ⇒ AWSCDK::EC2::NatTrafficDirection?
readonly
Direction to allow all traffic through the NAT instance by default.
-
#instance_type ⇒ AWSCDK::EC2::InstanceType
readonly
Instance type of the NAT instance.
- #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
The machine image (AMI) to use.
-
#security_group ⇒ AWSCDK::EC2::ISecurityGroup?
readonly
deprecated
Deprecated.
- Cannot create a new security group before the VPC is created, and cannot create the VPC without the NAT provider. Set {@link defaultAllowedTraffic } to {@link NatTrafficDirection.NONE } and use {@link NatInstanceProviderV2.gatewayInstances } to retrieve the instances on the fly and add security groups
-
#user_data ⇒ AWSCDK::EC2::UserData?
readonly
Custom user data to run on the NAT instances.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(instance_type:, associate_public_ip_address: nil, credit_specification: nil, default_allowed_traffic: nil, key_name: nil, key_pair: nil, machine_image: nil, security_group: nil, user_data: nil) ⇒ NatInstanceProps
constructor
A new instance of NatInstanceProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(instance_type:, associate_public_ip_address: nil, credit_specification: nil, default_allowed_traffic: nil, key_name: nil, key_pair: nil, machine_image: nil, security_group: nil, user_data: nil) ⇒ NatInstanceProps
Returns a new instance of NatInstanceProps.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'ec2/nat_instance_props.rb', line 16 def initialize(instance_type:, associate_public_ip_address: nil, credit_specification: nil, default_allowed_traffic: nil, key_name: nil, key_pair: nil, machine_image: nil, security_group: nil, user_data: nil) @instance_type = instance_type Jsii::Type.check_type(@instance_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluc3RhbmNlVHlwZSJ9")), "instanceType") @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? @credit_specification = credit_specification Jsii::Type.check_type(@credit_specification, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkNwdUNyZWRpdHMifQ==")), "creditSpecification") unless @credit_specification.nil? @default_allowed_traffic = default_allowed_traffic Jsii::Type.check_type(@default_allowed_traffic, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk5hdFRyYWZmaWNEaXJlY3Rpb24ifQ==")), "defaultAllowedTraffic") unless @default_allowed_traffic.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? @machine_image = machine_image Jsii::Type.check_type(@machine_image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklNYWNoaW5lSW1hZ2UifQ==")), "machineImage") unless @machine_image.nil? @security_group = security_group Jsii::Type.check_type(@security_group, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLklTZWN1cml0eUdyb3VwIn0=")), "securityGroup") unless @security_group.nil? @user_data = user_data Jsii::Type.check_type(@user_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlVzZXJEYXRhIn0=")), "userData") unless @user_data.nil? end |
Instance Attribute Details
#associate_public_ip_address ⇒ Boolean? (readonly)
Default: undefined - No public IP address associated
Whether to associate a public IP address to the primary network interface attached to this instance.
45 46 47 |
# File 'ec2/nat_instance_props.rb', line 45 def associate_public_ip_address @associate_public_ip_address 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 dedicated host (host) tenancy.
52 53 54 |
# File 'ec2/nat_instance_props.rb', line 52 def credit_specification @credit_specification end |
#default_allowed_traffic ⇒ AWSCDK::EC2::NatTrafficDirection? (readonly)
Default: NatTrafficDirection.INBOUND_AND_OUTBOUND
Direction to allow all traffic through the NAT instance by default.
By default, inbound and outbound traffic is allowed.
If you set this to another value than INBOUND_AND_OUTBOUND, you must
configure the NAT instance's security groups in another way, either by
passing in a fully configured Security Group using the security_group
property, or by configuring it using the .securityGroup or
.connections members after passing the NAT Instance Provider to a Vpc.
65 66 67 |
# File 'ec2/nat_instance_props.rb', line 65 def default_allowed_traffic @default_allowed_traffic end |
#instance_type ⇒ AWSCDK::EC2::InstanceType (readonly)
Instance type of the NAT instance.
40 41 42 |
# File 'ec2/nat_instance_props.rb', line 40 def instance_type @instance_type end |
#key_name ⇒ String? (readonly)
Default: - No SSH access will be possible.
Name of SSH keypair to grant access to instance.
71 72 73 |
# File 'ec2/nat_instance_props.rb', line 71 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.
76 77 78 |
# File 'ec2/nat_instance_props.rb', line 76 def key_pair @key_pair end |
#machine_image ⇒ AWSCDK::EC2::IMachineImage? (readonly)
Default: - Latest NAT instance image
The machine image (AMI) to use.
By default, will do an AMI lookup for the latest NAT instance image.
If you have a specific AMI ID you want to use, pass a GenericLinuxImage. For example:
AWSCDK::EC2::NatProvider.instance({
instance_type: AWSCDK::EC2::InstanceType.new("t3.micro"),
machine_image: AWSCDK::EC2::GenericLinuxImage.new({
"us-east-2" => "ami-0f9c61b5a562a16af",
}),
})
94 95 96 |
# File 'ec2/nat_instance_props.rb', line 94 def machine_image @machine_image end |
#security_group ⇒ AWSCDK::EC2::ISecurityGroup? (readonly)
- Cannot create a new security group before the VPC is created, and cannot create the VPC without the NAT provider. Set {@link defaultAllowedTraffic } to {@link NatTrafficDirection.NONE } and use {@link NatInstanceProviderV2.gatewayInstances } to retrieve the instances on the fly and add security groups
Default: - A new security group will be created
Security Group for NAT instances.
115 116 117 |
# File 'ec2/nat_instance_props.rb', line 115 def security_group @security_group end |
#user_data ⇒ AWSCDK::EC2::UserData? (readonly)
Default: UserData.forLinux().addCommands(...NatInstanceProviderV2.DEFAULT_USER_DATA_COMMANDS); - Appropriate user data commands to initialize and configure the NAT instances
Custom user data to run on the NAT instances.
121 122 123 |
# File 'ec2/nat_instance_props.rb', line 121 def user_data @user_data end |
Class Method Details
.jsii_properties ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'ec2/nat_instance_props.rb', line 123 def self.jsii_properties { :instance_type => "instanceType", :associate_public_ip_address => "associatePublicIpAddress", :credit_specification => "creditSpecification", :default_allowed_traffic => "defaultAllowedTraffic", :key_name => "keyName", :key_pair => "keyPair", :machine_image => "machineImage", :security_group => "securityGroup", :user_data => "userData", } end |
Instance Method Details
#to_jsii ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'ec2/nat_instance_props.rb', line 137 def to_jsii result = {} result.merge!({ "instanceType" => @instance_type, "associatePublicIpAddress" => @associate_public_ip_address, "creditSpecification" => @credit_specification, "defaultAllowedTraffic" => @default_allowed_traffic, "keyName" => @key_name, "keyPair" => @key_pair, "machineImage" => @machine_image, "securityGroup" => @security_group, "userData" => @user_data, }) result.compact end |