interface NatInstanceProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.NatInstanceProps |
Java | software.amazon.awscdk.services.ec2.NatInstanceProps |
Python | aws_cdk.aws_ec2.NatInstanceProps |
TypeScript (source) | @aws-cdk/aws-ec2 » NatInstanceProps |
Properties for a NAT instance.
Example
// Configure the `natGatewayProvider` when defining a Vpc
const natGatewayProvider = ec2.NatProvider.instance({
instanceType: new ec2.InstanceType('t3.small'),
});
const vpc = new ec2.Vpc(this, 'MyVpc', {
natGatewayProvider,
// The 'natGateways' parameter now controls the number of NAT instances
natGateways: 2,
});
Properties
Name | Type | Description |
---|---|---|
instance | Instance | Instance type of the NAT instance. |
allow | boolean | Allow all inbound traffic through the NAT instance. |
default | Nat | Direction to allow all traffic through the NAT instance by default. |
key | string | Name of SSH keypair to grant access to instance. |
machine | IMachine | The machine image (AMI) to use. |
security | ISecurity | Security Group for NAT instances. |
instanceType
Type:
Instance
Instance type of the NAT instance.
allowAllTraffic?
⚠️ Deprecated: - Use defaultAllowedTraffic
.
Type:
boolean
(optional, default: true)
Allow all inbound traffic through the NAT instance.
If you set this to false, you must configure the NAT instance's security
groups in another way, either by passing in a fully configured Security
Group using the securityGroup
property, or by configuring it using the
.securityGroup
or .connections
members after passing the NAT Instance
Provider to a Vpc.
defaultAllowedTraffic?
Type:
Nat
(optional, 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 securityGroup
property, or by configuring it using the .securityGroup
or
.connections
members after passing the NAT Instance Provider to a Vpc.
keyName?
Type:
string
(optional, default: No SSH access will be possible.)
Name of SSH keypair to grant access to instance.
machineImage?
Type:
IMachine
(optional, 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:
ec2.NatProvider.instance({
instanceType: new ec2.InstanceType('t3.micro'),
machineImage: new ec2.GenericLinuxImage({
'us-east-2': 'ami-0f9c61b5a562a16af'
})
})
securityGroup?
Type:
ISecurity
(optional, default: A new security group will be created)
Security Group for NAT instances.