Skip to content

Conversation

@weicongw
Copy link
Contributor

Issue #, if available:

Description of changes:
This PR addresses an issue with subnet creation by correcting the Availability Zones (AZs) used. Previously, subnets were created in the first two AZs of the region, which often led to failures due to mismatches with capacity reservations. This PR ensures that subnets are created in AZs that align with the specified capacity reservations.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@weicongw weicongw marked this pull request as ready for review September 16, 2024 21:30
Comment on lines +93 to +100
var subnetAzs []string
if opts.CapacityReservation {
subnetAzs, err = m.getAZsWithCapacity(opts)
if err != nil {
return nil, err
}
for _, az := range azs.AvailabilityZones {
if len(subnetAzs) == 2 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we have a panic if there is only 1 AZ with reserved capacity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't, reserved capacity is usually associated with only one AZ.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this approach, but it would be better if we just create subnets in All AZs and don't worry about reserved capacity's AZ.

@Issacwww Issacwww merged commit 05e0da5 into aws:main Sep 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants