TransitGateway
- class aws_cdk.aws_ec2_alpha.TransitGateway(scope, id, *, amazon_side_asn=None, auto_accept_shared_attachments=None, default_route_table_association=None, default_route_table_propagation=None, description=None, dns_support=None, security_group_referencing_support=None, transit_gateway_cidr_blocks=None, transit_gateway_name=None)
Bases:
Resource
(experimental) Creates a Transit Gateway.
- Stability:
experimental
- Resource:
AWS::EC2::TransitGateway
- ExampleMetadata:
infused
Example:
transit_gateway = TransitGateway(self, "MyTransitGateway") route_table = transit_gateway.add_route_table("CustomRouteTable") my_vpc = VpcV2(self, "Vpc") subnet = SubnetV2(self, "Subnet", vpc=my_vpc, availability_zone="eu-west-2a", ipv4_cidr_block=IpCidr("10.0.0.0/24"), subnet_type=SubnetType.PUBLIC ) attachment = transit_gateway.attach_vpc("VpcAttachment", vpc=my_vpc, subnets=[subnet] ) # Associate an attachment with a route table route_table.add_association("Association", attachment) # Enable route propagation for an attachment route_table.enable_propagation("Propagation", attachment)
- Parameters:
scope (
Construct
) –id (
str
) –amazon_side_asn (
Union
[int
,float
,None
]) – (experimental) A private Autonomous System Number (ASN) for the Amazon side of a BGP session. The range is 64512 to 65534 for 16-bit ASNs. Default: - undefined, 64512 is assigned by CloudFormation.auto_accept_shared_attachments (
Optional
[bool
]) – (experimental) Enable or disable automatic acceptance of cross-account attachment requests. Default: - disable (false)default_route_table_association (
Optional
[bool
]) – (experimental) Enable or disable automatic association with the default association route table. Default: - enable (true)default_route_table_propagation (
Optional
[bool
]) – (experimental) Enable or disable automatic propagation of routes to the default propagation route table. Default: - enable (true)description (
Optional
[str
]) – (experimental) The description of the transit gateway. Default: - no descriptiondns_support (
Optional
[bool
]) – (experimental) Enable or disable DNS support. If dnsSupport is enabled on a VPC Attachment, this also needs to be enabled for the feature to work. Otherwise the resources will still deploy but the feature will not work. Default: - enable (true)security_group_referencing_support (
Optional
[bool
]) – (experimental) Enable or disable security group referencing support. If securityGroupReferencingSupport is enabled on a VPC Attachment, this also needs to be enabled for the feature to work. Otherwise the resources will still deploy but the feature will not work. Default: - disable (false)transit_gateway_cidr_blocks (
Optional
[Sequence
[str
]]) – (experimental) The transit gateway CIDR blocks. Default: - nonetransit_gateway_name (
Optional
[str
]) – (experimental) Physical name of this Transit Gateway. Default: - Assigned by CloudFormation.
- Stability:
experimental
Methods
- add_route_table(id)
(experimental) Adds a new route table to the Transit Gateway.
- Parameters:
id (
str
) –- Return type:
- Returns:
The created Transit Gateway route table.
- Stability:
experimental
- apply_removal_policy(policy)
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
RemovalPolicy
) –- Return type:
None
- attach_vpc(id, *, subnets, vpc, association_route_table=None, propagation_route_tables=None, transit_gateway_attachment_name=None, vpc_attachment_options=None)
(experimental) Attaches a VPC to the Transit Gateway.
- Parameters:
id (
str
) –subnets (
Sequence
[ISubnet
]) – (experimental) A list of one or more subnets to place the attachment in. It is recommended to specify more subnets for better availability.vpc (
IVpc
) – (experimental) A VPC attachment(s) will get assigned to.association_route_table (
Optional
[ITransitGatewayRouteTable
]) – (experimental) An optional route table to associate with this VPC attachment. Default: - No associations will be created unless it is for the default route table and automatic association is enabled.propagation_route_tables (
Optional
[Sequence
[ITransitGatewayRouteTable
]]) – (experimental) A list of optional route tables to propagate routes to. Default: - No propagations will be created unless it is for the default route table and automatic propagation is enabled.transit_gateway_attachment_name (
Optional
[str
]) – (experimental) Physical name of this Transit Gateway VPC Attachment. Default: - Assigned by CloudFormation.vpc_attachment_options (
Optional
[ITransitGatewayVpcAttachmentOptions
]) – (experimental) The VPC attachment options. Default: - All options are disabled.
- Return type:
- Returns:
The created Transit Gateway VPC attachment.
- Stability:
experimental
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- default_route_table
(experimental) The default route table associated with the Transit Gateway.
This route table is created by the CDK and is used to manage the routes for attachments that do not have an explicitly defined route table association.
- Stability:
experimental
- default_route_table_association
(experimental) Indicates whether new attachments are automatically associated with the default route table.
If set to
true
, any VPC or VPN attachment will be automatically associated with the default route table unless otherwise specified.- Stability:
experimental
- default_route_table_propagation
(experimental) Indicates whether route propagation to the default route table is enabled.
When set to
true
, routes from attachments will be automatically propagated to the default route table unless propagation is explicitly disabled.- Stability:
experimental
- dns_support
(experimental) Whether or not DNS support is enabled on the Transit Gateway.
- Stability:
experimental
- env
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
- node
The tree node.
- router_target_id
(experimental) The ID of the route target.
- Stability:
experimental
- router_type
(experimental) The type of router used in the route.
- Stability:
experimental
- security_group_referencing_support
(experimental) Whether or not security group referencing support is enabled on the Transit Gateway.
- Stability:
experimental
- stack
The stack in which this resource is defined.
- transit_gateway_arn
(experimental) The Amazon Resource Name (ARN) of the Transit Gateway.
The ARN uniquely identifies the Transit Gateway across AWS and is commonly used for permissions and resource tracking.
- Stability:
experimental
- transit_gateway_id
(experimental) The unique identifier of the Transit Gateway.
This ID is automatically assigned by AWS upon creation of the Transit Gateway and is used to reference it in various configurations and operations.
- Stability:
experimental
Static Methods
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
- classmethod is_owned_resource(construct)
Returns true if the construct was created by CDK, and false otherwise.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool