Skip to content

create_transit_gateway async

create_transit_gateway(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    description: Optional[String] = None,
    options: Optional[TransitGatewayRequestOptions] = None,
    tag_specifications: Optional[TagSpecificationList] = None,
    dry_run: Optional[Boolean] = None,
) -> CreateTransitGatewayResult

Creates a transit gateway.

You can use a transit gateway to interconnect your virtual private clouds (VPC) and on-premises networks. After the transit gateway enters the available state, you can attach your VPCs and VPN connections to the transit gateway.

To attach your VPCs, use CreateTransitGatewayVpcAttachment.

To attach a VPN connection, use CreateCustomerGateway to create a customer gateway and specify the ID of the customer gateway and the ID of the transit gateway in a call to CreateVpnConnection.

When you create a transit gateway, we create a default transit gateway route table and use it as the default association route table and the default propagation route table. You can use CreateTransitGatewayRouteTable to create additional transit gateway route tables. If you disable automatic route propagation, we do not create a default transit gateway route table. You can use EnableTransitGatewayRouteTablePropagation to propagate routes from a resource attachment to a transit gateway route table. If you disable automatic associations, you can use AssociateTransitGatewayRouteTable to associate a resource attachment with a transit gateway route table.

Parameters:

  • description (Optional[String], default: None ) –

    A description of the transit gateway.

  • options (Optional[TransitGatewayRequestOptions], default: None ) –

    The transit gateway options.

  • tag_specifications (Optional[TagSpecificationList], default: None ) –

    The tags to apply to the transit gateway.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def create_transit_gateway(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    description: Optional["capo_ec2.types.string.String"] = None,
    options: Optional[
        "capo_ec2.types.transit_gateway_request_options.TransitGatewayRequestOptions"
    ] = None,
    tag_specifications: Optional[
        "capo_ec2.types.tag_specification_list.TagSpecificationList"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.create_transit_gateway_result.CreateTransitGatewayResult":
    """<p>Creates a transit gateway.</p> <p>You can use a transit gateway to interconnect your virtual private clouds (VPC) and on-premises networks. After the transit gateway enters the <code>available</code> state, you can attach your VPCs and VPN connections to the transit gateway.</p> <p>To attach your VPCs, use <a>CreateTransitGatewayVpcAttachment</a>.</p> <p>To attach a VPN connection, use <a>CreateCustomerGateway</a> to create a customer gateway and specify the ID of the customer gateway and the ID of the transit gateway in a call to <a>CreateVpnConnection</a>.</p> <p>When you create a transit gateway, we create a default transit gateway route table and use it as the default association route table and the default propagation route table. You can use <a>CreateTransitGatewayRouteTable</a> to create additional transit gateway route tables. If you disable automatic route propagation, we do not create a default transit gateway route table. You can use <a>EnableTransitGatewayRouteTablePropagation</a> to propagate routes from a resource attachment to a transit gateway route table. If you disable automatic associations, you can use <a>AssociateTransitGatewayRouteTable</a> to associate a resource attachment with a transit gateway route table.</p>

    Args:
        description: <p>A description of the transit gateway.</p>
        options: <p>The transit gateway options.</p>
        tag_specifications: <p>The tags to apply to the transit gateway.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.create_transit_gateway_request.CreateTransitGatewayRequest]",
    ) -> AsyncOperationResponse[
        "capo_ec2.types.create_transit_gateway_result.CreateTransitGatewayResult"
    ]:
        import capo_ec2._operations.amazon_ec2.create_transit_gateway

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.create_transit_gateway.async_create_transit_gateway(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTransitGateway")
    )
    input_: capo_ec2.types.create_transit_gateway_request.CreateTransitGatewayRequest = {}
    if description is not None:
        input_["description"] = description
    if options is not None:
        input_["options"] = options
    if tag_specifications is not None:
        input_["tag_specifications"] = tag_specifications
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output