EC2 / Client / modify_transit_gateway_attachment_nat_configuration

modify_transit_gateway_attachment_nat_configuration

EC2.Client.modify_transit_gateway_attachment_nat_configuration(**kwargs)

Modifies the NAT configuration for the specified transit gateway attachment. Use this operation to do the following:

  • Enable or disable NAT gateway support for the attachment.

  • Specify whether the transit gateway installs routes for the NAT CIDRs.

  • Replace the NAT gateway rules for the attachment.

Only the owner of the transit gateway can modify the NAT configuration.

With NAT gateway support enabled, the transit gateway translates addresses in each rule’s MatchSourceCidr range to the corresponding addresses in its NatCidr range.

The transit gateway applies changes asynchronously. To check the result, use GetTransitGatewayAttachmentNatConfiguration.

See also: AWS API Documentation

Request Syntax

response = client.modify_transit_gateway_attachment_nat_configuration(
    TransitGatewayAttachmentId='string',
    NatGatewaySupport='enable'|'disable',
    NatSystemRouteSupport='enable'|'disable',
    NatGatewayRules=[
        {
            'RuleNumber': 123,
            'MatchSourceCidr': 'string',
            'NatCidr': 'string'
        },
    ],
    ResetNatGatewayRules=True|False,
    DryRun=True|False
)
Parameters:
  • TransitGatewayAttachmentId (string) –

    [REQUIRED]

    The ID of the transit gateway attachment.

  • NatGatewaySupport (string) – Specifies whether to enable or disable NAT gateway support for the attachment. To enable NAT gateway support, the attachment must have at least one NAT gateway rule. You can’t modify the NAT configuration while NAT gateway support is enabling or disabling. If you omit this parameter, the current value doesn’t change.

  • NatSystemRouteSupport (string) – Specifies whether the transit gateway installs routes for the NAT CIDRs in the route tables to which the attachment propagates. For VPC attachments, the transit gateway always installs these routes. You can enable or disable this option only for Amazon Web Services Direct Connect gateway attachments and Site-to-Site VPN attachments that use dynamic routing. For these attachments, the default is enable. If you omit this parameter, the current value doesn’t change.

  • NatGatewayRules (list) –

    The NAT gateway rules for the attachment. The rules that you specify replace all existing NAT gateway rules for the attachment. You can specify up to 50 rules for an attachment. If you omit this parameter, the existing rules don’t change. To remove all rules, use ResetNatGatewayRules.

    • (dict) –

      Describes a NAT gateway rule to apply to a transit gateway attachment. A NAT gateway rule translates source addresses in the MatchSourceCidr range to the corresponding addresses in the NatCidr range.

      • RuleNumber (integer) –

        The rule number. Valid values are 1 to 32766. Each rule number must be unique within the request.

      • MatchSourceCidr (string) –

        The IPv4 CIDR block of the source addresses to translate. The CIDR block can’t overlap the multicast range ( 224.0.0.0/4) or the link-local range ( 169.254.0.0/16).

      • NatCidr (string) –

        The IPv4 CIDR block to translate the source addresses to. The CIDR block must be in a private (RFC 1918) or shared address space (RFC 6598) range, and must have the same prefix length as MatchSourceCidr. The CIDR blocks in the rules for an attachment can’t overlap each other.

  • ResetNatGatewayRules (boolean) – Specifies whether to remove all NAT gateway rules from the attachment. If you omit this parameter, the transit gateway doesn’t remove any rules. You can’t specify this parameter together with NatGatewayRules. Because you can’t enable NAT gateway support without rules, also set NatGatewaySupport to disable in the same request if NAT gateway support is currently enabled.

  • DryRun (boolean) – 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.

Return type:

dict

Returns:

Response Syntax

{
    'TransitGatewayAttachmentId': 'string',
    'NatGatewaySupport': 'enabled'|'disabled'|'enabling'|'disabling',
    'NatSystemRouteSupport': 'enable'|'disable',
    'NatGatewayRules': [
        {
            'RuleNumber': 123,
            'MatchSourceCidr': 'string',
            'NatCidr': 'string',
            'State': 'pending'|'activated'|'deactivated'|'deleting'
        },
    ]
}

Response Structure

  • (dict) –

    • TransitGatewayAttachmentId (string) –

      The ID of the transit gateway attachment.

    • NatGatewaySupport (string) –

      The state of NAT gateway support for the attachment.

    • NatSystemRouteSupport (string) –

      Specifies whether the transit gateway installs routes for the NAT CIDRs in the route tables to which the attachment propagates.

    • NatGatewayRules (list) –

      The NAT gateway rules for the attachment.

      • (dict) –

        Contains information about a NAT gateway rule for a transit gateway attachment, including the rule number, the source CIDR block, the translated CIDR block, and the state of the rule.

        • RuleNumber (integer) –

          The rule number.

        • MatchSourceCidr (string) –

          The IPv4 CIDR block of the source addresses to translate.

        • NatCidr (string) –

          The IPv4 CIDR block that the transit gateway translates the source addresses to.

        • State (string) –

          The state of the NAT gateway rule. The possible values are:

          • pending - The transit gateway is applying a change to the rule.

          • activated - The rule is in effect because NAT gateway support is enabled for the attachment.

          • deactivated - The rule isn’t in effect because NAT gateway support is disabled for the attachment.