AWS v6.73.0 published on Wednesday, Mar 19, 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<GetTransit 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
[]GetTransit 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<GetTransit 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
GetTransit 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[GetTransit 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:
- AmazonSide intAsn 
- Private Autonomous System Number (ASN) for the Amazon side of a BGP session
- Arn string
- EC2 Transit Gateway ARN
- AssociationDefault stringRoute Table Id 
- Identifier of the default association route table
- string
- Whether resource attachment requests are automatically accepted
- DefaultRoute stringTable Association 
- Whether resource attachments are automatically associated with the default association route table
- DefaultRoute stringTable Propagation 
- Whether resource attachments automatically propagate routes to the default propagation route table
- Description string
- Description of the EC2 Transit Gateway
- DnsSupport string
- Whether DNS support is enabled
- Id string
- EC2 Transit Gateway identifier
- MulticastSupport string
- Whether Multicast support is enabled
- OwnerId string
- Identifier of the AWS account that owns the EC2 Transit Gateway
- PropagationDefault stringRoute Table Id 
- Identifier of the default propagation route table
- SecurityGroup stringReferencing Support 
- Whether Security Group Referencing Support is enabled
- Dictionary<string, string>
- Key-value tags for the EC2 Transit Gateway
- TransitGateway List<string>Cidr Blocks 
- The list of associated CIDR blocks
- VpnEcmp stringSupport 
- Whether VPN Equal Cost Multipath Protocol support is enabled
- Filters
List<GetTransit Gateway Filter> 
- AmazonSide intAsn 
- Private Autonomous System Number (ASN) for the Amazon side of a BGP session
- Arn string
- EC2 Transit Gateway ARN
- AssociationDefault stringRoute Table Id 
- Identifier of the default association route table
- string
- Whether resource attachment requests are automatically accepted
- DefaultRoute stringTable Association 
- Whether resource attachments are automatically associated with the default association route table
- DefaultRoute stringTable Propagation 
- Whether resource attachments automatically propagate routes to the default propagation route table
- Description string
- Description of the EC2 Transit Gateway
- DnsSupport string
- Whether DNS support is enabled
- Id string
- EC2 Transit Gateway identifier
- MulticastSupport string
- Whether Multicast support is enabled
- OwnerId string
- Identifier of the AWS account that owns the EC2 Transit Gateway
- PropagationDefault stringRoute Table Id 
- Identifier of the default propagation route table
- SecurityGroup stringReferencing Support 
- Whether Security Group Referencing Support is enabled
- map[string]string
- Key-value tags for the EC2 Transit Gateway
- TransitGateway []stringCidr Blocks 
- The list of associated CIDR blocks
- VpnEcmp stringSupport 
- Whether VPN Equal Cost Multipath Protocol support is enabled
- Filters
[]GetTransit Gateway Filter 
- amazonSide IntegerAsn 
- Private Autonomous System Number (ASN) for the Amazon side of a BGP session
- arn String
- EC2 Transit Gateway ARN
- associationDefault StringRoute Table Id 
- Identifier of the default association route table
- String
- Whether resource attachment requests are automatically accepted
- defaultRoute StringTable Association 
- Whether resource attachments are automatically associated with the default association route table
- defaultRoute StringTable Propagation 
- Whether resource attachments automatically propagate routes to the default propagation route table
- description String
- Description of the EC2 Transit Gateway
- dnsSupport String
- Whether DNS support is enabled
- id String
- EC2 Transit Gateway identifier
- multicastSupport String
- Whether Multicast support is enabled
- ownerId String
- Identifier of the AWS account that owns the EC2 Transit Gateway
- propagationDefault StringRoute Table Id 
- Identifier of the default propagation route table
- securityGroup StringReferencing Support 
- Whether Security Group Referencing Support is enabled
- Map<String,String>
- Key-value tags for the EC2 Transit Gateway
- transitGateway List<String>Cidr Blocks 
- The list of associated CIDR blocks
- vpnEcmp StringSupport 
- Whether VPN Equal Cost Multipath Protocol support is enabled
- filters
List<GetTransit Gateway Filter> 
- amazonSide numberAsn 
- Private Autonomous System Number (ASN) for the Amazon side of a BGP session
- arn string
- EC2 Transit Gateway ARN
- associationDefault stringRoute Table Id 
- Identifier of the default association route table
- string
- Whether resource attachment requests are automatically accepted
- defaultRoute stringTable Association 
- Whether resource attachments are automatically associated with the default association route table
- defaultRoute stringTable Propagation 
- Whether resource attachments automatically propagate routes to the default propagation route table
- description string
- Description of the EC2 Transit Gateway
- dnsSupport string
- Whether DNS support is enabled
- id string
- EC2 Transit Gateway identifier
- multicastSupport string
- Whether Multicast support is enabled
- ownerId string
- Identifier of the AWS account that owns the EC2 Transit Gateway
- propagationDefault stringRoute Table Id 
- Identifier of the default propagation route table
- securityGroup stringReferencing Support 
- Whether Security Group Referencing Support is enabled
- {[key: string]: string}
- Key-value tags for the EC2 Transit Gateway
- transitGateway string[]Cidr Blocks 
- The list of associated CIDR blocks
- vpnEcmp stringSupport 
- Whether VPN Equal Cost Multipath Protocol support is enabled
- filters
GetTransit 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[GetTransit Gateway Filter] 
- amazonSide NumberAsn 
- Private Autonomous System Number (ASN) for the Amazon side of a BGP session
- arn String
- EC2 Transit Gateway ARN
- associationDefault StringRoute Table Id 
- Identifier of the default association route table
- String
- Whether resource attachment requests are automatically accepted
- defaultRoute StringTable Association 
- Whether resource attachments are automatically associated with the default association route table
- defaultRoute StringTable Propagation 
- Whether resource attachments automatically propagate routes to the default propagation route table
- description String
- Description of the EC2 Transit Gateway
- dnsSupport String
- Whether DNS support is enabled
- id String
- EC2 Transit Gateway identifier
- multicastSupport String
- Whether Multicast support is enabled
- ownerId String
- Identifier of the AWS account that owns the EC2 Transit Gateway
- propagationDefault StringRoute Table Id 
- Identifier of the default propagation route table
- securityGroup StringReferencing Support 
- Whether Security Group Referencing Support is enabled
- Map<String>
- Key-value tags for the EC2 Transit Gateway
- transitGateway List<String>Cidr Blocks 
- The list of associated CIDR blocks
- vpnEcmp 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.