sassoftware / viya4-iac-aws

This project contains Terraform configuration files to provision infrastructure components required to deploy SAS Viya platform products products on Amazon AWS.
Apache License 2.0
39 stars 45 forks source link

VPC subnets span multiple availability zones #147

Closed hyweldaniels closed 12 months ago

hyweldaniels commented 2 years ago

In the default configuration, subnets span multiple availability zones. E.g. when deploying to the us-east-1 location; the first public subnet will be in AZ us-east-1a and the second will be in us-east-1b.

As a result; in the event of an EC2 failure, the new EC2 instance may start in a different AZ. When this happens, Viya can fail to start because the supporting EBS volumes remain in the original AZ.

Current documentation suggests that node pools spanning multiple AZs is not recommended (https://go.documentation.sas.com/doc/en/itopscdc/v_029/itopssr/n1ika6zxghgsoqn1mq4bck9dx695.htm#p04yhay0uqh6uwn1o42lmln1qpw5).

During the creation of the VPC subnets, count based indexing is used to ensure the 2 public/private/database subnets each use a distinct availability zone (https://github.com/sassoftware/viya4-iac-aws/blob/main/modules/aws_vpc/main.tf#L78);

availability_zone       = length(regexall("^[a-z]{2}-", element(var.azs, count.index))) > 0 ? element(var.azs, count.index) : null

To follow current recommended best practice for Viya, can the Terraform configuration be modified to use a single AZ? E.g.;

availability_zone       = length(regexall("^[a-z]{2}-", element(var.azs, 0))) > 0 ? element(var.azs, 0) : null

I tested this change internally and found that it appears to behave as expected with all subnets being created in the first returned AZ (in my case, us-east-1a).

dhoucgitter commented 12 months ago

@hyweldaniels, check out the updates made in PR #239 that will have EKS node pools configured to use a single AZ by default. Changes for that PR and a couple of other PRs for the upcoming viya4-iac-aws release are breaking changes so you will not be able to update a cluster created with an earlier version of viya4-iac-aws to use a single AZ for your nodes. Release notes will state that creating a new cluster to adopt a single AZ approach for your nodes will be required.

dhoucgitter commented 12 months ago

Closing, https://github.com/sassoftware/viya4-iac-aws/pull/239 updates iac-aws behavior so that EKS node pools are configured to use a single AZ by default.