# Creating a AWS VPC with IPv6 addresses

**URL:** <https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 13, 2020, 6:20pm UTC](https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457 "2020-03-13T18:20:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralf\_Weber](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@Ralf\_Weber](https://forum.ansible.com/u/Ralf_Weber)\
**Post date:** [March 13, 2020, 6:20pm UTC](https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457/1 "2020-03-13T18:20:22Z")

</div>

Moin!

I wanted to use ansible to create a VPC with Amazon supplied IPv6 addresses. In the Console this is an option, when I create and VPC, but I could not find anything in ec2\_vpc\_net for that.

When I use ec2\_vpc\_net\_info I see the IPv6 association of the other VPCs I created manually, and I see that ec2\_vpc\_subnet has the ability to let instances get and IPv6 address, but that needs to be specified out of the /56 that normally is assigned from Amazon per VPC.

What is missing is the initial option to create the /56 for the VPC or am I missing something?

TIA and so long  
-Ralf

---

<div class="post-metadata">

**Author:** ![Karl\_Auer](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@Karl\_Auer](https://forum.ansible.com/u/Karl_Auer)\
**Post date:** [March 13, 2020, 10:24pm UTC](https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457/2 "2020-03-13T22:24:08Z")

</div>

I haven’t tried this myself, but what happens if you just provide iPv6 addresses to the ec2\_vpc\_net module?

The “initial /56” is just the CIDR block, I’d have thought, same as with IPv4. But as I say I have not tried this.

Regards, K.

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 14, 2020, 8:07am UTC](https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457/3 "2020-03-14T08:07:59Z")

</div>

Hi

> Moin!
> 
> I wanted to use ansible to create a VPC with Amazon supplied IPv6  
> addresses. In the Console this is an option, when I create and VPC, but  
> I could not find anything in ec2\_vpc\_net for that.
> 
> When I use ec2\_vpc\_net\_info I see the IPv6 association of the other VPCs  
> I created manually, and I see that ec2\_vpc\_subnet has the ability to let  
> instances get and IPv6 address, but that needs to be specified out of  
> the /56 that normally is assigned from Amazon per VPC.
> 
> What is missing is the initial option to create the /56 for the VPC or  
> am I missing something?

This is indeed not supporting by the ec2\_vpc\_net module.  
I am using an aws cli helper task, which needs to be conditional to  
prevent adding the prefix when it's already there:

- name: Ensure VPC is available  
&nbsp;&nbsp;ec2\_vpc\_net:  
&nbsp;&nbsp;&nbsp;&nbsp;name: my\_vpc  
&nbsp;&nbsp;&nbsp;&nbsp;cidr\_block: 10.0.0.0/24  
&nbsp;&nbsp;register: realized\_vpc

# Workaround because ec2\_vpc\_net doesn't have IPv6 functionality, see  
# [https://github.com/ansible/ansible/issues/27800](https://github.com/ansible/ansible/issues/27800) for the list of open  
IPv6 issues.  
- name: Ensure VPC has IPv6 prefix  
&nbsp;&nbsp;command: aws ec2 associate-vpc-cidr-block  
&nbsp;&nbsp;&nbsp;&nbsp;--amazon-provided-ipv6-cidr-block --vpc-id "{{ realized\_vpc.vpc.id }}"  
&nbsp;&nbsp;when: realized\_vpc.vpc.ipv6\_cidr\_block\_association\_set is not defined

This works and is idempotent as well.

---

<div class="post-metadata">

**Author:** ![Ralf\_Weber](https://avatars.discourse-cdn.com/v4/letter/r/ed655f/32.png) [@Ralf\_Weber](https://forum.ansible.com/u/Ralf_Weber)\
**Post date:** [March 15, 2020, 8:29am UTC](https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457/4 "2020-03-15T08:29:05Z")

</div>

Moin!

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 16, 2020, 3:04pm UTC](https://forum.ansible.com/t/creating-a-aws-vpc-with-ipv6-addresses/32457/5 "2020-03-16T15:04:27Z")

</div>

Good to hear.  
We are running many dual stack environments that are deployed with ansible.  
They do require a little bit of tinkering because of said limitations  
but overall we are very happy with the set-up.  
Don't hesitate to ask questions about it.

thx
