Skip to content

Commit

Permalink
feat(ec2): add dual stack vpc support (#28480)
Browse files Browse the repository at this point in the history
Adds parameter to configure a dual stack vpc, `vpcProtocol: ec2.VpcProtocol.DUAL_STACK`.

By default a dual stack vpc will:

- Create an Amazon provided IPv6 CIDR block (/56) and associate it to the VPC.
- Assign a portion of the block to each of the subnets (/64)
- Enable autoassigning an IPv6 address for each subnet
- **Disable autoassigning public IPv4 addresses** for each subnet
- Create an Egress Only Internet Gateway for private subnets
- Configure IPv6 routes for IGWs and EIGWs

Addresses #894.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
scanlonp authored Jan 12, 2024
1 parent d07deec commit caf83f1
Show file tree
Hide file tree
Showing 30 changed files with 40,811 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from http.server import SimpleHTTPRequestHandler
import urllib.request
import json

class MyRequestHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.send_header('Content-type', 'application/json')
self.end_headers()

try:
# IPv4 request
response = urllib.request.urlopen('http://ipv4.google.com')
status_code = response.getcode()
if (status_code != 200):
raise Exception(f"Received a non-successful status code: {status_code}")

# IPv6 request
response = urllib.request.urlopen('http://ipv6.google.com')
status_code = response.getcode()
if (status_code != 200):
raise Exception(f"Received a non-successful status code: {status_code}")

json_response = {
"status": status_code
}

self.wfile.write(json.dumps(json_response).encode('utf-8'))
except Exception as e:
self.wfile.write(bytes(f"Error: {str(e)}", 'utf-8'))
return
else:
super().do_GET()

if __name__ == '__main__':
from http.server import HTTPServer
server = HTTPServer(('0.0.0.0', 8000), MyRequestHandler)
print('Server started on http://0.0.0.0:8000')
server.serve_forever()

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit caf83f1

Please sign in to comment.