Deploying Subnets using Ansible
Subnets are a fundamental networking construct in AWS, enabling enhanced resiliency for applications deployed on the cloud. By mapping subnets to different Availability Zones, we can ensure high availability, distributing resources across zones to mitigate the impact of any single-zone failure. This approach strengthens the deployment’s reliability and availability.
Within an AWS Region, where we have deployed the VPC, AWS offers Availability Zones to provide resiliency for physical infrastructure, and efficient use involves distributing infrastructure across them within a VPC, which belongs to a Region. This is achieved using AWS subnets.
In our example, we deploy two subnets across two Availability Zones to ensure high availability. Each subnet is defined with its own CIDR block (which must be a subset of the VPC CIDR), an Availability Zone, and relevant tags. Availability Zones are named by AWS Region plus a suffix (e.g., a, b, etc...