https://pulumi.com logo
#python
Title
# python
m

miniature-art-58368

03/24/2020, 7:59 PM
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

gentle-diamond-70147

03/31/2020, 12:26 AM
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)
3 Views