Class NatInstanceProps.Builder
java.lang.Object
software.amazon.awscdk.services.ec2.NatInstanceProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<NatInstanceProps>
- Enclosing interface:
- NatInstanceProps
@Stability(Stable)
public static final class NatInstanceProps.Builder
extends Object
implements software.amazon.jsii.Builder<NatInstanceProps>
A builder for
NatInstanceProps-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallowAllTraffic(Boolean allowAllTraffic) Deprecated.- Use `defaultAllowedTraffic`.build()Builds the configured instance.defaultAllowedTraffic(NatTrafficDirection defaultAllowedTraffic) Sets the value ofNatInstanceProps.getDefaultAllowedTraffic()instanceType(InstanceType instanceType) Sets the value ofNatInstanceProps.getInstanceType()Sets the value ofNatInstanceProps.getKeyName()machineImage(IMachineImage machineImage) Sets the value ofNatInstanceProps.getMachineImage()securityGroup(ISecurityGroup securityGroup) Sets the value ofNatInstanceProps.getSecurityGroup()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
instanceType
Sets the value ofNatInstanceProps.getInstanceType()- Parameters:
instanceType- Instance type of the NAT instance. This parameter is required.- Returns:
this
-
allowAllTraffic
@Stability(Deprecated) @Deprecated public NatInstanceProps.Builder allowAllTraffic(Boolean allowAllTraffic) Deprecated.- Use `defaultAllowedTraffic`.Sets the value ofNatInstanceProps.getAllowAllTraffic()- Parameters:
allowAllTraffic- 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 thesecurityGroupproperty, or by configuring it using the.securityGroupor.connectionsmembers after passing the NAT Instance Provider to a Vpc.- Returns:
this
-
defaultAllowedTraffic
@Stability(Stable) public NatInstanceProps.Builder defaultAllowedTraffic(NatTrafficDirection defaultAllowedTraffic) Sets the value ofNatInstanceProps.getDefaultAllowedTraffic()- Parameters:
defaultAllowedTraffic- 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
securityGroupproperty, or by configuring it using the.securityGroupor.connectionsmembers after passing the NAT Instance Provider to a Vpc.- Returns:
this
-
keyName
Sets the value ofNatInstanceProps.getKeyName()- Parameters:
keyName- Name of SSH keypair to grant access to instance.- Returns:
this
-
machineImage
Sets the value ofNatInstanceProps.getMachineImage()- Parameters:
machineImage- 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:NatProvider.instance(NatInstanceProps.builder() .instanceType(new InstanceType("t3.micro")) .machineImage(new GenericLinuxImage(Map.of( "us-east-2", "ami-0f9c61b5a562a16af"))) .build());- Returns:
this
-
securityGroup
Sets the value ofNatInstanceProps.getSecurityGroup()- Parameters:
securityGroup- Security Group for NAT instances.- Returns:
this
-
build
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<NatInstanceProps>- Returns:
- a new instance of
NatInstanceProps - Throws:
NullPointerException- if any required attribute was not provided
-