If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
12.12.6
What operating system are you using?
macOS
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
N/A
Describe the bug
Attempting to create an Amplify project, with containers, in regions with fewer than 3 AZs results in an error: The requested number of subnets exceeds the number of AZs for the region. This appears to be because of a hardcoded value for the subnets argument to getEnvironmentNetworkInfo in env-level-constructs.ts.
Expected behavior
The number of requested subnets does not exceed the number of availability zones for the selected region.
Reproduction steps
Initialize a new Amplify project in a region with < 3 availability zones (e.g., us-west-1)
Add container support with amplify configure projects > Advanced: Container-based deployments
Add a containerized API with amplify add api > REST > API Gateway + AWS Fargate (Container-based) > (accept defaults for remaining options)
amplify push -y
Project Identifier
0ef4cab727ef3e2dd0a288133a105af9
Log output
```
2024-08-28T16:29:54.915Z|info : amplify add api
2024-08-28T16:29:54.994Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-08-28T16:30:07.403Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["personal"])
2024-08-28T16:30:07.406Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"credential_process":"","region":"us-west-1"}])
2024-08-28T16:30:12.437Z|info : amplify status core {"yes":false}
2024-08-28T16:30:12.515Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-08-28T16:30:13.758Z|info : amplify-provider-awscloudformation.display-helpful-urls.showCognitoSandBoxMessage(["containeraztest"])
2024-08-28T16:30:23.944Z|info : amplify push core {"yes":true}
2024-08-28T16:30:24.025Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
2024-08-28T16:30:25.443Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["personal"])
2024-08-28T16:30:25.446Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"credential_process":"","region":"us-west-1"}])
2024-08-28T16:30:25.455Z|info : amplify-provider-awscloudformation.zip-util.downloadZip.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip"},null])
2024-08-28T16:30:25.456Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]rent-[***]ud-[***]d.zip","Bucket":"[***]ify-[***]aztest-[***]ev-[***]74-[***]ment"}])
2024-08-28T16:30:25.766Z|info : amplify-provider-awscloudformation.initialize-env.run.cfn.updateamplifyMetaFileWithStackOutputs([{"StackName":"[***]ify-[***]aztest-[***]ev-[***]74"}])
2024-08-28T16:30:25.767Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["personal"])
2024-08-28T16:30:25.769Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"credential_process":"","region":"us-west-1"}])
2024-08-28T16:30:25.778Z|info : amplify-provider-awscloudformation.aws-cfn.updateamplifyMetaFileWithStackOutputs.cfn.listStackResources([{"StackName":"[***]ify-[***]aztest-[***]ev-[***]74"}])
2024-08-28T16:30:26.078Z|info : amplify-provider-awscloudformation.aws-cfn.describeStack.cfn.describeStacks([{"StackName":"[***]ify-[***]aztest-[***]ev-[***]74"}])
2024-08-28T16:30:26.363Z|info : amplify-provider-awscloudformation.aws-s3.s3.getFile([{"Key":"[***]ify-[***]json","Bucket":"[***]ify-[***]aztest-[***]ev-[***]74-[***]ment"}])
2024-08-28T16:30:26.811Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["personal"])
2024-08-28T16:30:26.812Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"credential_process":"","region":"us-west-1"}])
2024-08-28T16:30:27.043Z|info : amplify-provider-awscloudformation.system-config-manager.getProfileConfig(["personal"])
2024-08-28T16:30:27.044Z|info : amplify-provider-awscloudformation.system-config-manager.getProfiledAwsConfig.profileConfig([{"credential_process":"","region":"us-west-1"}])
2024-08-28T16:30:27.481Z|error : The requested number of subnets exceeds the number of AZs for the region. {
"subnets": 3,
"azs": 2
}
ConfigurationError: The requested number of subnets exceeds the number of AZs for the region. {
"subnets": 3,
"azs": 2
}
2024-08-28T16:31:39.010Z|info : amplify diagnose core {"send-report":true,"yes":false}
2024-08-28T16:31:39.091Z|info : @aws-amplify/amplify-cli-core.banner-message/index.ts.fetch banner messages from https://aws-amplify.github.io/amplify-cli/banner-message.json({}
```
Additional information
No response
Before submitting, please confirm:
[X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
[X] I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
12.12.6
What operating system are you using?
macOS
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
N/A
Describe the bug
Attempting to create an Amplify project, with containers, in regions with fewer than 3 AZs results in an error:
The requested number of subnets exceeds the number of AZs for the region.
This appears to be because of a hardcoded value for thesubnets
argument togetEnvironmentNetworkInfo
in env-level-constructs.ts.Expected behavior
The number of requested subnets does not exceed the number of availability zones for the selected region.
Reproduction steps
us-west-1
)amplify configure projects
>Advanced: Container-based deployments
amplify add api
>REST
>API Gateway + AWS Fargate (Container-based)
> (accept defaults for remaining options)amplify push -y
Project Identifier
0ef4cab727ef3e2dd0a288133a105af9
Log output
Additional information
No response
Before submitting, please confirm: