Class CfnRoute

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:00.406Z") @Stability(Stable) public class CfnRoute extends CfnResource implements IInspectable
Specifies a route in a route table. For more information, see Routes in the Amazon VPC User Guide .

You must specify either a destination CIDR block or prefix list ID. You must also specify exactly one of the resources as the target.

If you create a route that references a transit gateway in the same template where you create the transit gateway, you must declare a dependency on the transit gateway attachment. The route table cannot use the transit gateway until it has successfully attached to the VPC. Add a DependsOn Attribute in the AWS::EC2::Route resource to explicitly declare a dependency on the AWS::EC2::TransitGatewayAttachment resource.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.ec2.*;
 CfnRoute cfnRoute = CfnRoute.Builder.create(this, "MyCfnRoute")
         .routeTableId("routeTableId")
         // the properties below are optional
         .carrierGatewayId("carrierGatewayId")
         .coreNetworkArn("coreNetworkArn")
         .destinationCidrBlock("destinationCidrBlock")
         .destinationIpv6CidrBlock("destinationIpv6CidrBlock")
         .destinationPrefixListId("destinationPrefixListId")
         .egressOnlyInternetGatewayId("egressOnlyInternetGatewayId")
         .gatewayId("gatewayId")
         .instanceId("instanceId")
         .localGatewayId("localGatewayId")
         .natGatewayId("natGatewayId")
         .networkInterfaceId("networkInterfaceId")
         .transitGatewayId("transitGatewayId")
         .vpcEndpointId("vpcEndpointId")
         .vpcPeeringConnectionId("vpcPeeringConnectionId")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnRoute

      protected CfnRoute(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnRoute

      protected CfnRoute(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnRoute

      @Stability(Stable) public CfnRoute(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnRouteProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrCidrBlock

      @Stability(Stable) @NotNull public String getAttrCidrBlock()
      The IPv4 CIDR block.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getRouteTableId

      @Stability(Stable) @NotNull public String getRouteTableId()
      The ID of the route table for the route.
    • setRouteTableId

      @Stability(Stable) public void setRouteTableId(@NotNull String value)
      The ID of the route table for the route.
    • getCarrierGatewayId

      @Stability(Stable) @Nullable public String getCarrierGatewayId()
      The ID of the carrier gateway.
    • setCarrierGatewayId

      @Stability(Stable) public void setCarrierGatewayId(@Nullable String value)
      The ID of the carrier gateway.
    • getCoreNetworkArn

      @Stability(Stable) @Nullable public String getCoreNetworkArn()
      The Amazon Resource Name (ARN) of the core network.
    • setCoreNetworkArn

      @Stability(Stable) public void setCoreNetworkArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the core network.
    • getDestinationCidrBlock

      @Stability(Stable) @Nullable public String getDestinationCidrBlock()
      The IPv4 CIDR address block used for the destination match.
    • setDestinationCidrBlock

      @Stability(Stable) public void setDestinationCidrBlock(@Nullable String value)
      The IPv4 CIDR address block used for the destination match.
    • getDestinationIpv6CidrBlock

      @Stability(Stable) @Nullable public String getDestinationIpv6CidrBlock()
      The IPv6 CIDR block used for the destination match.
    • setDestinationIpv6CidrBlock

      @Stability(Stable) public void setDestinationIpv6CidrBlock(@Nullable String value)
      The IPv6 CIDR block used for the destination match.
    • getDestinationPrefixListId

      @Stability(Stable) @Nullable public String getDestinationPrefixListId()
      The ID of a prefix list used for the destination match.
    • setDestinationPrefixListId

      @Stability(Stable) public void setDestinationPrefixListId(@Nullable String value)
      The ID of a prefix list used for the destination match.
    • getEgressOnlyInternetGatewayId

      @Stability(Stable) @Nullable public String getEgressOnlyInternetGatewayId()
      [IPv6 traffic only] The ID of an egress-only internet gateway.
    • setEgressOnlyInternetGatewayId

      @Stability(Stable) public void setEgressOnlyInternetGatewayId(@Nullable String value)
      [IPv6 traffic only] The ID of an egress-only internet gateway.
    • getGatewayId

      @Stability(Stable) @Nullable public String getGatewayId()
      The ID of an internet gateway or virtual private gateway attached to your VPC.
    • setGatewayId

      @Stability(Stable) public void setGatewayId(@Nullable String value)
      The ID of an internet gateway or virtual private gateway attached to your VPC.
    • getInstanceId

      @Stability(Stable) @Nullable public String getInstanceId()
      The ID of a NAT instance in your VPC.
    • setInstanceId

      @Stability(Stable) public void setInstanceId(@Nullable String value)
      The ID of a NAT instance in your VPC.
    • getLocalGatewayId

      @Stability(Stable) @Nullable public String getLocalGatewayId()
      The ID of the local gateway.
    • setLocalGatewayId

      @Stability(Stable) public void setLocalGatewayId(@Nullable String value)
      The ID of the local gateway.
    • getNatGatewayId

      @Stability(Stable) @Nullable public String getNatGatewayId()
      [IPv4 traffic only] The ID of a NAT gateway.
    • setNatGatewayId

      @Stability(Stable) public void setNatGatewayId(@Nullable String value)
      [IPv4 traffic only] The ID of a NAT gateway.
    • getNetworkInterfaceId

      @Stability(Stable) @Nullable public String getNetworkInterfaceId()
      The ID of a network interface.
    • setNetworkInterfaceId

      @Stability(Stable) public void setNetworkInterfaceId(@Nullable String value)
      The ID of a network interface.
    • getTransitGatewayId

      @Stability(Stable) @Nullable public String getTransitGatewayId()
      The ID of a transit gateway.
    • setTransitGatewayId

      @Stability(Stable) public void setTransitGatewayId(@Nullable String value)
      The ID of a transit gateway.
    • getVpcEndpointId

      @Stability(Stable) @Nullable public String getVpcEndpointId()
      The ID of a VPC endpoint.
    • setVpcEndpointId

      @Stability(Stable) public void setVpcEndpointId(@Nullable String value)
      The ID of a VPC endpoint.
    • getVpcPeeringConnectionId

      @Stability(Stable) @Nullable public String getVpcPeeringConnectionId()
      The ID of a VPC peering connection.
    • setVpcPeeringConnectionId

      @Stability(Stable) public void setVpcPeeringConnectionId(@Nullable String value)
      The ID of a VPC peering connection.