File size: 7,154 Bytes
071aea2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
**Example 1: To create a VPN connection with dynamic routing**

The following ``create-vpn-connection`` example creates a VPN connection between the specified virtual private gateway and the specified customer gateway, and applies tags to the VPN connection. The output includes the configuration information for your customer gateway device, in XML format. ::

    aws ec2 create-vpn-connection \
        --type ipsec.1 \
        --customer-gateway-id cgw-001122334455aabbc \
        --vpn-gateway-id vgw-1a1a1a1a1a1a2b2b2 \
        --tag-specification 'ResourceType=vpn-connection,Tags=[{Key=Name,Value=BGP-VPN}]'

Output::

    {
        "VpnConnection": {
            "CustomerGatewayConfiguration": "...configuration information...",
            "CustomerGatewayId": "cgw-001122334455aabbc",
            "Category": "VPN",
            "State": "pending",
            "VpnConnectionId": "vpn-123123123123abcab",
            "VpnGatewayId": "vgw-1a1a1a1a1a1a2b2b2",
            "Options": {
                "EnableAcceleration": false,
                "StaticRoutesOnly": false,
                "LocalIpv4NetworkCidr": "0.0.0.0/0",
                "RemoteIpv4NetworkCidr": "0.0.0.0/0",
                "TunnelInsideIpVersion": "ipv4",
                "TunnelOptions": [
                    {},
                    {}
                ]
            },
            "Routes": [],
            "Tags": [
                 {
                    "Key": "Name",
                    "Value": "BGP-VPN"
                }
            ]
        }
    }

For more information, see `How AWS Site-to-Site VPN works <https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html>`__ in the *AWS Site-to-Site VPN User Guide*.

**Example 2: To create a VPN connection with static routing**

The following ``create-vpn-connection`` example creates a VPN connection between the specified virtual private gateway and the specified customer gateway. The options specify static routing. The output includes the configuration information for your customer gateway device, in XML format. ::

    aws ec2 create-vpn-connection \
        --type ipsec.1 \
        --customer-gateway-id cgw-001122334455aabbc \
        --vpn-gateway-id vgw-1a1a1a1a1a1a2b2b2 \
        --options "{\"StaticRoutesOnly\":true}"

Output::

    {
        "VpnConnection": {
            "CustomerGatewayConfiguration": "..configuration information...",
            "CustomerGatewayId": "cgw-001122334455aabbc",
            "Category": "VPN",
            "State": "pending",
            "VpnConnectionId": "vpn-123123123123abcab",
            "VpnGatewayId": "vgw-1a1a1a1a1a1a2b2b2",
            "Options": {
                "EnableAcceleration": false,
                "StaticRoutesOnly": true,
                "LocalIpv4NetworkCidr": "0.0.0.0/0",
                "RemoteIpv4NetworkCidr": "0.0.0.0/0",
                "TunnelInsideIpVersion": "ipv4",
                "TunnelOptions": [
                    {},
                    {}
                ]
            },
            "Routes": [],
            "Tags": []
        }
    }

For more information, see `How AWS Site-to-Site VPN works <https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html>`__ in the *AWS Site-to-Site VPN User Guide*.

**Example 3: To create a VPN connection and specify your own inside CIDR and pre-shared key**

The following ``create-vpn-connection`` example creates a VPN connection and specifies the inside IP address CIDR block and a custom pre-shared key for each tunnel. The specified values are returned in the ``CustomerGatewayConfiguration`` information. ::

    aws ec2 create-vpn-connection \
        --type ipsec.1 \
        --customer-gateway-id cgw-001122334455aabbc \
        --vpn-gateway-id vgw-1a1a1a1a1a1a2b2b2 \
        --options TunnelOptions='[{TunnelInsideCidr=169.254.12.0/30,PreSharedKey=ExamplePreSharedKey1},{TunnelInsideCidr=169.254.13.0/30,PreSharedKey=ExamplePreSharedKey2}]'

Output::

    {
        "VpnConnection": {
            "CustomerGatewayConfiguration": "..configuration information...",
            "CustomerGatewayId": "cgw-001122334455aabbc",
            "Category": "VPN",
            "State": "pending",
            "VpnConnectionId": "vpn-123123123123abcab",
            "VpnGatewayId": "vgw-1a1a1a1a1a1a2b2b2",
            "Options": {
                "EnableAcceleration": false,
                "StaticRoutesOnly": false,
                "LocalIpv4NetworkCidr": "0.0.0.0/0",
                "RemoteIpv4NetworkCidr": "0.0.0.0/0",
                "TunnelInsideIpVersion": "ipv4",
                "TunnelOptions": [
                    {
                        "OutsideIpAddress": "203.0.113.3",
                        "TunnelInsideCidr": "169.254.12.0/30",
                        "PreSharedKey": "ExamplePreSharedKey1"
                    },
                    {
                        "OutsideIpAddress": "203.0.113.5",
                        "TunnelInsideCidr": "169.254.13.0/30",
                        "PreSharedKey": "ExamplePreSharedKey2"
                    }
                ]
            },
            "Routes": [],
            "Tags": []
        }
    }

For more information, see `How AWS Site-to-Site VPN works <https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html>`__ in the *AWS Site-to-Site VPN User Guide*.

**Example 4: To create a VPN connection that supports IPv6 traffic**

The following ``create-vpn-connection`` example creates a VPN connection that supports IPv6 traffic between the specified transit gateway and specified customer gateway. The tunnel options for both tunnels specify that AWS must initiate the IKE negotiation. ::

    aws ec2 create-vpn-connection \
        --type ipsec.1 \
        --transit-gateway-id tgw-12312312312312312 \
        --customer-gateway-id cgw-001122334455aabbc \
        --options TunnelInsideIpVersion=ipv6,TunnelOptions=[{StartupAction=start},{StartupAction=start}]

Output::

    {
        "VpnConnection": {
            "CustomerGatewayConfiguration": "..configuration information...",
            "CustomerGatewayId": "cgw-001122334455aabbc",
            "Category": "VPN",
            "State": "pending",
            "VpnConnectionId": "vpn-11111111122222222",
            "TransitGatewayId": "tgw-12312312312312312",
            "Options": {
                "EnableAcceleration": false,
                "StaticRoutesOnly": false,
                "LocalIpv6NetworkCidr": "::/0",
                "RemoteIpv6NetworkCidr": "::/0",
                "TunnelInsideIpVersion": "ipv6",
                "TunnelOptions": [
                    {
                        "OutsideIpAddress": "203.0.113.3",
                        "StartupAction": "start"
                    },
                    {
                        "OutsideIpAddress": "203.0.113.5",
                        "StartupAction": "start"
                    }
                ]
            },
            "Routes": [],
            "Tags": []
        }
    }

For more information, see `How AWS Site-to-Site VPN works <https://docs.aws.amazon.com/vpn/latest/s2svpn/how_it_works.html>`__ in the *AWS Site-to-Site VPN User Guide*.