Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ec2: Value (dummy1a) for parameter availabilityZone is invalid error #30582

Closed
Henry01234 opened this issue Jun 19, 2024 · 3 comments
Closed
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. feature-request A feature should be added or improved. p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@Henry01234
Copy link

Henry01234 commented Jun 19, 2024

Status

Resolved

What is the issue?

The issue is related to how AWS CDK assigns availability zones (AvailabilityZone) during the creation of subnets. AWS CDK typically manages availability zones automatically based on the regions and availability zones available to your AWS account. However, sometimes there might be issues where AWS CDK incorrectly assigns an availability zone that is not valid or expected.

Error message

error
handler returned message: "Value (dummy1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-east-1a, us-east-1b, us-east-1c, us-east-1d, us-east-1e, us-east-1f. (Service: Ec2, Status Code: 400, Request ID: d5e85ac0-9386-494c-8db5-a2ff7501f77f)" (RequestToken: 2f242e5e-1a76-b08a-1177-01e4f5af8f84, HandlerErrorCode: InvalidRequest)

What is the impact?

It makes it difficult to make use of CDK Script to provision resources on AWS

Workaround

We can use this to create the VPC And Subnet separately, so it doesn't need to assign dummy1a to the Subnet created with (SubnetConfiguration)...
init {
// Create VPC with no subnets initially
val vpc = Vpc(this, "myVpc-01", VpcProps.builder()
.cidr("10.0.0.0/16")
.subnetConfiguration(emptyList())
.build())

    // Create subnets with specified availability zones
    val subnet1 = Subnet(this, "publicSubnet-01", SubnetProps.builder()
        .vpcId(vpc.vpcId)
        .availabilityZone("us-east-1a")
        .cidrBlock("10.0.0.0/18")
        .mapPublicIpOnLaunch(true)
        .build())

    val subnet2 = Subnet(this, "publicSubnet-02", SubnetProps.builder()
        .vpcId(vpc.vpcId)
        .availabilityZone("us-east-1b")
        .cidrBlock("10.0.64.0/18")
        .mapPublicIpOnLaunch(true)
        .build())
        }

Who is affected?

Devolopers, Software Engineers and Cloud Engineers

How do I resolve this?

make sure to read the Documentation properly. And check the ### Workaround I provided It worked!!
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Subnet.html

Related issues

..

@Henry01234 Henry01234 added management/tracking Issues that track a subject or multiple issues p0 labels Jun 19, 2024
@pahud pahud added feature-request A feature should be added or improved. @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud p3 and removed management/tracking Issues that track a subject or multiple issues p0 labels Jun 19, 2024
@pahud
Copy link
Contributor

pahud commented Jun 19, 2024

error
handler returned message: "Value (dummy1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: us-east-1a, us-east-1b, us-east-1c, us-east-1d, us-east-1e, us-east-1f. (Service: Ec2, Status Code: 400, Request ID: d5e85ac0-9386-494c-8db5-a2ff7501f77f)" (RequestToken: 2f242e5e-1a76-b08a-1177-01e4f5af8f84, HandlerErrorCode: InvalidRequest)

Can you share your CDK code snippet that returns this error?

@pahud pahud added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jun 19, 2024
@pahud pahud changed the title AWS CDK Script Implementation ec2: Value (dummy1a) for parameter availabilityZone is invalid error Jun 19, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 21, 2024
@github-actions github-actions bot added closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 26, 2024
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. feature-request A feature should be added or improved. p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants