AWS v6.77.1 published on Friday, Apr 18, 2025 by Pulumi
aws.ec2transitgateway.getTransitGateway
Explore with Pulumi AI
Get information on an EC2 Transit Gateway.
Example Usage
By Filter
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2transitgateway.getTransitGateway({
    filters: [{
        name: "options.amazon-side-asn",
        values: ["64512"],
    }],
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.get_transit_gateway(filters=[{
    "name": "options.amazon-side-asn",
    "values": ["64512"],
}])
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.LookupTransitGateway(ctx, &ec2transitgateway.LookupTransitGatewayArgs{
			Filters: []ec2transitgateway.GetTransitGatewayFilter{
				{
					Name: "options.amazon-side-asn",
					Values: []string{
						"64512",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2TransitGateway.GetTransitGateway.Invoke(new()
    {
        Filters = new[]
        {
            new Aws.Ec2TransitGateway.Inputs.GetTransitGatewayFilterInputArgs
            {
                Name = "options.amazon-side-asn",
                Values = new[]
                {
                    "64512",
                },
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetTransitGatewayArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var example = Ec2transitgatewayFunctions.getTransitGateway(GetTransitGatewayArgs.builder()
            .filters(GetTransitGatewayFilterArgs.builder()
                .name("options.amazon-side-asn")
                .values("64512")
                .build())
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getTransitGateway
      arguments:
        filters:
          - name: options.amazon-side-asn
            values:
              - '64512'
By Identifier
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2transitgateway.getTransitGateway({
    id: "tgw-12345678",
});
import pulumi
import pulumi_aws as aws
example = aws.ec2transitgateway.get_transit_gateway(id="tgw-12345678")
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2transitgateway.LookupTransitGateway(ctx, &ec2transitgateway.LookupTransitGatewayArgs{
			Id: pulumi.StringRef("tgw-12345678"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() => 
{
    var example = Aws.Ec2TransitGateway.GetTransitGateway.Invoke(new()
    {
        Id = "tgw-12345678",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2transitgateway.Ec2transitgatewayFunctions;
import com.pulumi.aws.ec2transitgateway.inputs.GetTransitGatewayArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var example = Ec2transitgatewayFunctions.getTransitGateway(GetTransitGatewayArgs.builder()
            .id("tgw-12345678")
            .build());
    }
}
variables:
  example:
    fn::invoke:
      function: aws:ec2transitgateway:getTransitGateway
      arguments:
        id: tgw-12345678
Using getTransitGateway
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getTransitGateway(args: GetTransitGatewayArgs, opts?: InvokeOptions): Promise<GetTransitGatewayResult>
function getTransitGatewayOutput(args: GetTransitGatewayOutputArgs, opts?: InvokeOptions): Output<GetTransitGatewayResult>def get_transit_gateway(filters: Optional[Sequence[GetTransitGatewayFilter]] = None,
                        id: Optional[str] = None,
                        tags: Optional[Mapping[str, str]] = None,
                        opts: Optional[InvokeOptions] = None) -> GetTransitGatewayResult
def get_transit_gateway_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetTransitGatewayFilterArgs]]]] = None,
                        id: Optional[pulumi.Input[str]] = None,
                        tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetTransitGatewayResult]func LookupTransitGateway(ctx *Context, args *LookupTransitGatewayArgs, opts ...InvokeOption) (*LookupTransitGatewayResult, error)
func LookupTransitGatewayOutput(ctx *Context, args *LookupTransitGatewayOutputArgs, opts ...InvokeOption) LookupTransitGatewayResultOutput> Note: This function is named LookupTransitGateway in the Go SDK.
public static class GetTransitGateway 
{
    public static Task<GetTransitGatewayResult> InvokeAsync(GetTransitGatewayArgs args, InvokeOptions? opts = null)
    public static Output<GetTransitGatewayResult> Invoke(GetTransitGatewayInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTransitGatewayResult> getTransitGateway(GetTransitGatewayArgs args, InvokeOptions options)
public static Output<GetTransitGatewayResult> getTransitGateway(GetTransitGatewayArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ec2transitgateway/getTransitGateway:getTransitGateway
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<Get
Transit Gateway Filter>  - One or more configuration blocks containing name-values filters. Detailed below.
 - Id string
 - Identifier of the EC2 Transit Gateway.
 - Dictionary<string, string>
 - Key-value tags for the EC2 Transit Gateway
 
- Filters
[]Get
Transit Gateway Filter  - One or more configuration blocks containing name-values filters. Detailed below.
 - Id string
 - Identifier of the EC2 Transit Gateway.
 - map[string]string
 - Key-value tags for the EC2 Transit Gateway
 
- filters
List<Get
Transit Gateway Filter>  - One or more configuration blocks containing name-values filters. Detailed below.
 - id String
 - Identifier of the EC2 Transit Gateway.
 - Map<String,String>
 - Key-value tags for the EC2 Transit Gateway
 
- filters
Get
Transit Gateway Filter[]  - One or more configuration blocks containing name-values filters. Detailed below.
 - id string
 - Identifier of the EC2 Transit Gateway.
 - {[key: string]: string}
 - Key-value tags for the EC2 Transit Gateway
 
- filters
Sequence[Get
Transit Gateway Filter]  - One or more configuration blocks containing name-values filters. Detailed below.
 - id str
 - Identifier of the EC2 Transit Gateway.
 - Mapping[str, str]
 - Key-value tags for the EC2 Transit Gateway
 
- filters List<Property Map>
 - One or more configuration blocks containing name-values filters. Detailed below.
 - id String
 - Identifier of the EC2 Transit Gateway.
 - Map<String>
 - Key-value tags for the EC2 Transit Gateway
 
getTransitGateway Result
The following output properties are available:
- Amazon
Side intAsn  - Private Autonomous System Number (ASN) for the Amazon side of a BGP session
 - Arn string
 - EC2 Transit Gateway ARN
 - Association
Default stringRoute Table Id  - Identifier of the default association route table
 - string
 - Whether resource attachment requests are automatically accepted
 - Default
Route stringTable Association  - Whether resource attachments are automatically associated with the default association route table
 - Default
Route stringTable Propagation  - Whether resource attachments automatically propagate routes to the default propagation route table
 - Description string
 - Description of the EC2 Transit Gateway
 - Dns
Support string - Whether DNS support is enabled
 - Id string
 - EC2 Transit Gateway identifier
 - Multicast
Support string - Whether Multicast support is enabled
 - Owner
Id string - Identifier of the AWS account that owns the EC2 Transit Gateway
 - Propagation
Default stringRoute Table Id  - Identifier of the default propagation route table
 - Security
Group stringReferencing Support  - Whether Security Group Referencing Support is enabled
 - Dictionary<string, string>
 - Key-value tags for the EC2 Transit Gateway
 - Transit
Gateway List<string>Cidr Blocks  - The list of associated CIDR blocks
 - Vpn
Ecmp stringSupport  - Whether VPN Equal Cost Multipath Protocol support is enabled
 - Filters
List<Get
Transit Gateway Filter>  
- Amazon
Side intAsn  - Private Autonomous System Number (ASN) for the Amazon side of a BGP session
 - Arn string
 - EC2 Transit Gateway ARN
 - Association
Default stringRoute Table Id  - Identifier of the default association route table
 - string
 - Whether resource attachment requests are automatically accepted
 - Default
Route stringTable Association  - Whether resource attachments are automatically associated with the default association route table
 - Default
Route stringTable Propagation  - Whether resource attachments automatically propagate routes to the default propagation route table
 - Description string
 - Description of the EC2 Transit Gateway
 - Dns
Support string - Whether DNS support is enabled
 - Id string
 - EC2 Transit Gateway identifier
 - Multicast
Support string - Whether Multicast support is enabled
 - Owner
Id string - Identifier of the AWS account that owns the EC2 Transit Gateway
 - Propagation
Default stringRoute Table Id  - Identifier of the default propagation route table
 - Security
Group stringReferencing Support  - Whether Security Group Referencing Support is enabled
 - map[string]string
 - Key-value tags for the EC2 Transit Gateway
 - Transit
Gateway []stringCidr Blocks  - The list of associated CIDR blocks
 - Vpn
Ecmp stringSupport  - Whether VPN Equal Cost Multipath Protocol support is enabled
 - Filters
[]Get
Transit Gateway Filter  
- amazon
Side IntegerAsn  - Private Autonomous System Number (ASN) for the Amazon side of a BGP session
 - arn String
 - EC2 Transit Gateway ARN
 - association
Default StringRoute Table Id  - Identifier of the default association route table
 - String
 - Whether resource attachment requests are automatically accepted
 - default
Route StringTable Association  - Whether resource attachments are automatically associated with the default association route table
 - default
Route StringTable Propagation  - Whether resource attachments automatically propagate routes to the default propagation route table
 - description String
 - Description of the EC2 Transit Gateway
 - dns
Support String - Whether DNS support is enabled
 - id String
 - EC2 Transit Gateway identifier
 - multicast
Support String - Whether Multicast support is enabled
 - owner
Id String - Identifier of the AWS account that owns the EC2 Transit Gateway
 - propagation
Default StringRoute Table Id  - Identifier of the default propagation route table
 - security
Group StringReferencing Support  - Whether Security Group Referencing Support is enabled
 - Map<String,String>
 - Key-value tags for the EC2 Transit Gateway
 - transit
Gateway List<String>Cidr Blocks  - The list of associated CIDR blocks
 - vpn
Ecmp StringSupport  - Whether VPN Equal Cost Multipath Protocol support is enabled
 - filters
List<Get
Transit Gateway Filter>  
- amazon
Side numberAsn  - Private Autonomous System Number (ASN) for the Amazon side of a BGP session
 - arn string
 - EC2 Transit Gateway ARN
 - association
Default stringRoute Table Id  - Identifier of the default association route table
 - string
 - Whether resource attachment requests are automatically accepted
 - default
Route stringTable Association  - Whether resource attachments are automatically associated with the default association route table
 - default
Route stringTable Propagation  - Whether resource attachments automatically propagate routes to the default propagation route table
 - description string
 - Description of the EC2 Transit Gateway
 - dns
Support string - Whether DNS support is enabled
 - id string
 - EC2 Transit Gateway identifier
 - multicast
Support string - Whether Multicast support is enabled
 - owner
Id string - Identifier of the AWS account that owns the EC2 Transit Gateway
 - propagation
Default stringRoute Table Id  - Identifier of the default propagation route table
 - security
Group stringReferencing Support  - Whether Security Group Referencing Support is enabled
 - {[key: string]: string}
 - Key-value tags for the EC2 Transit Gateway
 - transit
Gateway string[]Cidr Blocks  - The list of associated CIDR blocks
 - vpn
Ecmp stringSupport  - Whether VPN Equal Cost Multipath Protocol support is enabled
 - filters
Get
Transit Gateway Filter[]  
- amazon_
side_ intasn  - Private Autonomous System Number (ASN) for the Amazon side of a BGP session
 - arn str
 - EC2 Transit Gateway ARN
 - association_
default_ strroute_ table_ id  - Identifier of the default association route table
 - str
 - Whether resource attachment requests are automatically accepted
 - default_
route_ strtable_ association  - Whether resource attachments are automatically associated with the default association route table
 - default_
route_ strtable_ propagation  - Whether resource attachments automatically propagate routes to the default propagation route table
 - description str
 - Description of the EC2 Transit Gateway
 - dns_
support str - Whether DNS support is enabled
 - id str
 - EC2 Transit Gateway identifier
 - multicast_
support str - Whether Multicast support is enabled
 - owner_
id str - Identifier of the AWS account that owns the EC2 Transit Gateway
 - propagation_
default_ strroute_ table_ id  - Identifier of the default propagation route table
 - security_
group_ strreferencing_ support  - Whether Security Group Referencing Support is enabled
 - Mapping[str, str]
 - Key-value tags for the EC2 Transit Gateway
 - transit_
gateway_ Sequence[str]cidr_ blocks  - The list of associated CIDR blocks
 - vpn_
ecmp_ strsupport  - Whether VPN Equal Cost Multipath Protocol support is enabled
 - filters
Sequence[Get
Transit Gateway Filter]  
- amazon
Side NumberAsn  - Private Autonomous System Number (ASN) for the Amazon side of a BGP session
 - arn String
 - EC2 Transit Gateway ARN
 - association
Default StringRoute Table Id  - Identifier of the default association route table
 - String
 - Whether resource attachment requests are automatically accepted
 - default
Route StringTable Association  - Whether resource attachments are automatically associated with the default association route table
 - default
Route StringTable Propagation  - Whether resource attachments automatically propagate routes to the default propagation route table
 - description String
 - Description of the EC2 Transit Gateway
 - dns
Support String - Whether DNS support is enabled
 - id String
 - EC2 Transit Gateway identifier
 - multicast
Support String - Whether Multicast support is enabled
 - owner
Id String - Identifier of the AWS account that owns the EC2 Transit Gateway
 - propagation
Default StringRoute Table Id  - Identifier of the default propagation route table
 - security
Group StringReferencing Support  - Whether Security Group Referencing Support is enabled
 - Map<String>
 - Key-value tags for the EC2 Transit Gateway
 - transit
Gateway List<String>Cidr Blocks  - The list of associated CIDR blocks
 - vpn
Ecmp StringSupport  - Whether VPN Equal Cost Multipath Protocol support is enabled
 - filters List<Property Map>
 
Supporting Types
GetTransitGatewayFilter   
- Name string
 - Name of the field to filter by, as defined by the underlying AWS API.
 - Values List<string>
 - List of one or more values for the filter.
 
- Name string
 - Name of the field to filter by, as defined by the underlying AWS API.
 - Values []string
 - List of one or more values for the filter.
 
- name String
 - Name of the field to filter by, as defined by the underlying AWS API.
 - values List<String>
 - List of one or more values for the filter.
 
- name string
 - Name of the field to filter by, as defined by the underlying AWS API.
 - values string[]
 - List of one or more values for the filter.
 
- name str
 - Name of the field to filter by, as defined by the underlying AWS API.
 - values Sequence[str]
 - List of one or more values for the filter.
 
- name String
 - Name of the field to filter by, as defined by the underlying AWS API.
 - values List<String>
 - List of one or more values for the filter.
 
Package Details
- Repository
 - AWS Classic pulumi/pulumi-aws
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
awsTerraform Provider.