> **Experimental**
>
> `@aws-cdk/aws-ec2-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# TransitGatewayRouteTable

Creates a Transit Gateway route table.

Extends: [Construct](/cdk/api/v2/docs/constructs.Construct.html) › [Resource](/cdk/api/v2/docs/aws-cdk-lib.Resource.html) › TransitGatewayRouteTable
Implements: [ITransitGatewayRouteTable](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.ITransitGatewayRouteTable.html), [IResource](/cdk/api/v2/docs/aws-cdk-lib.IResource.html), [IRouteTable](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IRouteTable.html), [IEnvironmentAware](/cdk/api/v2/docs/aws-cdk-lib.interfaces.IEnvironmentAware.html), IConstruct, IDependable

- Stability: [Experimental](/cdk/api/stability.html)
- CloudFormation: [`AWS::EC2::TransitGatewayRouteTable`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ec2-transitgatewayroutetable.html)
- L1 type: [`CfnTransitGatewayRouteTable`](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnTransitGatewayRouteTable.html)
- Source: [`lib/transit-gateway-route-table.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-ec2-alpha/lib/transit-gateway-route-table.ts#L110)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as ec2_alpha from '@aws-cdk/aws-ec2-alpha';

declare const transitGateway: ec2_alpha.TransitGateway;
const transitGatewayRouteTable = new ec2_alpha.TransitGatewayRouteTable(this, 'MyTransitGatewayRouteTable', {
  transitGateway: transitGateway,

  // the properties below are optional
  transitGatewayRouteTableName: 'transitGatewayRouteTableName',
});
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_ec2_alpha as ec2_alpha

# transit_gateway: ec2_alpha.TransitGateway

transit_gateway_route_table = ec2_alpha.TransitGatewayRouteTable(self, "MyTransitGatewayRouteTable",
    transit_gateway=transit_gateway,

    # the properties below are optional
    transit_gateway_route_table_name="transitGatewayRouteTableName"
)
```

Java:

```java
// 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.alpha.*;

TransitGateway transitGateway;

TransitGatewayRouteTable transitGatewayRouteTable = TransitGatewayRouteTable.Builder.create(this, "MyTransitGatewayRouteTable")
        .transitGateway(transitGateway)

        // the properties below are optional
        .transitGatewayRouteTableName("transitGatewayRouteTableName")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.ec2.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ec2.Alpha;

TransitGateway transitGateway;

var transitGatewayRouteTable = new TransitGatewayRouteTable(this, "MyTransitGatewayRouteTable", new TransitGatewayRouteTableProps {
    TransitGateway = transitGateway,

    // the properties below are optional
    TransitGatewayRouteTableName = "transitGatewayRouteTableName"
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsec2alpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import ec2_alpha "github.com/aws/aws-cdk-go/awsec2alpha"

var transitGateway TransitGateway

transitGatewayRouteTable := ec2_alpha.NewTransitGatewayRouteTable(this, jsii.String("MyTransitGatewayRouteTable"), &TransitGatewayRouteTableProps{
	TransitGateway: transitGateway,

	// the properties below are optional
	TransitGatewayRouteTableName: jsii.String("transitGatewayRouteTableName"),
})
```

## Initializer

TypeScript:

```ts
new TransitGatewayRouteTable(scope: Construct, id: string, props: TransitGatewayRouteTableProps)
```

Python:

```python
TransitGatewayRouteTable(scope: Construct, id: str, props: TransitGatewayRouteTableProps)
```

Java:

```java
new TransitGatewayRouteTable(Construct scope, String id, TransitGatewayRouteTableProps props)
```

C# / .NET:

```csharp
new TransitGatewayRouteTable(Construct scope, string id, TransitGatewayRouteTableProps props)
```

Golang:

```go
NewTransitGatewayRouteTable(Scope Construct, Id *string, Props TransitGatewayRouteTableProps)
```

## Construct Props

- `transitGateway`: [ITransitGateway](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.ITransitGateway.html) (required) — The Transit Gateway that this route table belongs to.

- `transitGatewayRouteTableName`: string — Physical name of this Transit Gateway Route Table.

  **Default:** Assigned by CloudFormation.

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `routeTableId`: string — Route table ID.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `transitGateway`: [ITransitGateway](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.ITransitGateway.html) — The Transit Gateway.

## Methods

- `addAssociation(id: string, transitGatewayAttachment: ITransitGatewayAttachment): ITransitGatewayRouteTableAssociation` — Associate the provided Attachments with this route table.

- `addBlackholeRoute(id: string, destinationCidr: string): ITransitGatewayRoute` — Add a blackhole route to this route table.

- `addRoute(id: string, transitGatewayAttachment: ITransitGatewayAttachment, destinationCidr: string): ITransitGatewayRoute` — Add an active route to this route table.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — 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`).

- `enablePropagation(id: string, transitGatewayAttachment: ITransitGatewayAttachment): ITransitGatewayRouteTablePropagation` — Enable propagation from the provided Attachments to this route table.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  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 class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` 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 the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
