How do I resolve the "Parameter validation failed: parameter value 'abc' for parameter name 'ABC' does not exist" error in CloudFormation?

5 minute read
0

When I create or update my AWS CloudFormation stack, I get the following error: "Parameter validation failed: parameter value 'abc' for parameter name 'ABC' does not exist." How can I resolve this error?

Short description

AWS CloudFormation returns the parameter validation failed error when one of the parameters that's used in your CloudFormation template is an AWS-specific parameter type.

You can receive this error when you use an AWS-specific parameter:

  • To pass a value that doesn't exist in the AWS Region or account during stack creation.
  • As a property for a resource, and then delete this value out of band before you update the resource during the stack update.
  • As a parameter in a child stack. The error occurs when the value of the child stack that's passed from the parent stack doesn't match the parameter type. The error also occurs when the parameter's resource doesn't exist in the account in that Region.

Resolution

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

Create a stack

1.    Open the AWS CloudFormation console.

2.    In the navigation pane, choose Stacks.

3.    Form the Stack name column, choose the stack that failed.

4.    Choose the Parameters tab.

5.    In the Key column, search for the ABC parameter with the abc value.

6.    Check the Parameters section of the template that's used to create your stack to verify that resource abc matches the AWS-specific parameter type.

7.    Verify that the abc resource for the ABC parameter exists in the Region or account. Use either the AWS Management Console or the AWS CLI command to describe the resource. To find the right command for your resource, see the Find the describe command for your resource section.

Note: For example, if you use the parameter type AWS::EC2::VPC::Id, then check the Amazon Virtual Private Cloud (Amazon VPC) console for the resource.

8.    If ABC is a parameter to the child stack, then you must pass the abc value. Choose Option A or Option B.

(Option A) If you're referencing another resource in the parent stack, then verify that this resource matches the AWS-specific parameter type used in the child stack.

Note: For example, the stack fails if you use the parameter type AWS::EC2::Subnet::Id (subnet) and refer to resource type AWS::EC2::VPC.

(Option B) If the abc value passes directly from the parent stack, then verify that the abc resource for the ABC parameter exists in the Region or account. Use either the AWS Management Console or the AWS CLI command to describe the resource. To find the right command for your resource, see the Find the describe command for your resource section.

For example, consider the following List parameter in the child stack:

"SecurityGroups": {
    "Description": "List of security group IDs for the instances",
    "Type": "List<AWS::EC2::SecurityGroup::Id>"
}

The value to the parameter passes from the parent stack. For example:

"ChildStack" : {
 "Type" : "AWS::CloudFormation::Stack",
 "Properties" : {
    "Parameters":{
      "KeyPair" : { "Ref": "KeyPair" },
      "ImageID" : { "Ref": "ImageID" },
      "InstanceType" : { "Ref": "InstanceType" },
      "SecurityGroups" : { "Ref": "SecurityGroup" }
    }

Important: In the preceding example, verify that the value of the security group ID that's passed to the SecurityGroup parameter exists in the Region or account.

9.    Create a new stack with a valid value for the parameter that exists in your Region or account and that matches the AWS-specific parameter type.

Update the stack

When a stack update fails, CloudFormation rolls back the changes. This means that you can't see the parameter value that's updated through the AWS CloudFormation console.

You must change the value for the ABC parameter during the update. If you don't change the value, then the resource with the name or PhysicalID of abc might be deleted from the account out of band.

1.    To verify that the resource exists, use either the AWS Management Console or the AWS CLI command to describe the resource. To find the right command for your resource, see the Find the describe command for your resource section.

2.    If you're updating the stack by updating the ABC parameter, then follow steps 6,7, and 8 in the preceding Create a stack section.

3.    Update the stack by passing a valid value to the ABC parameter.

Find the describe command for your resource

Choose the right command for your resource:

  • For AWS::EC2::Image::Id or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::Instance::Id or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::KeyPair::KeyName, use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::SecurityGroup::GroupName, AWS::EC2::SecurityGroup::Id, List , or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::Subnet::Id or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::VPC::Id or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::Route53::HostedZone::Id or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::AvailabilityZone::Name or List , use the command for AWS CLI version 1 or version 2.
  • For AWS::EC2::Volume::Id or List , use the command for AWS CLI version 1 or version 2.

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago