I am using aws_python how to I get the ipv6_cidr_b...
# python
m
I am using aws_python how to I get the ipv6_cidr_block of my vpc and pass it into my ipv6_cidr_block for my Subnet?
g
In general, you would do this like below. But AWS requires that the ipv6 block of a subnet be no larger than a
/64
and the VPC ipv6 returns a
/56
(in my case at least), so you'll need to manipulate
vpc.ipv6_cidr_block
before passing it into
ec2.Subnet(...)
.
Copy code
import pulumi
from pulumi_aws import ec2

vpc = ec2.Vpc('main',
            cidr_block='10.0.0.0/22',
            assign_generated_ipv6_cidr_block=True)

subnet = ec2.Subnet('public',
            vpc_id=vpc.id,
            cidr_block=vpc.cidr_block,
            ipv6_cidr_block=vpc.ipv6_cidr_block)