Skip to content

I have Yaml template that's failing when creating a Cloud Formation Stack

0

I am creating a CloudFormation stack from a YAML template. However, I made the necessary changes to the YAML file. Can someone please tell me what I am doing wrong, or is the YAML script problematic? See below for the YAML script. Thank you.

https://github.com/aws-samples/ec2-lamp-server/blob/main/UbuntuLinux-LAMP-server.yaml

I made these corrections to the original yaml file. See below.

ec2KeyPair Parameter:

Description:     The Description property is set to: "Specify the name of an existing EC2 Key Pair" ConstraintDescription:     The ConstraintDescription property is set to: "Specify the name of an existing EC2 Key Pair" AllowedPattern:     The AllowedPattern property is set to: "[\x20-\x7e]+" instanceType Parameter:

AllowedPattern:     The AllowedPattern property is set to: "^[a-z\-\d\.]+$"

Vince

asked a year ago147 views
1 Answer
0

Based on the information provided, there are a few steps you can take to troubleshoot and potentially resolve the issue with your CloudFormation stack creation:

  1. Validate your template: Before attempting to create the stack, use the CloudFormation template validation feature. You can do this using the AWS CLI command 'validate-template'. This will check for syntax errors in your YAML file.

  2. Check for default VPC: One common issue that can cause stack creation failures is the absence of a default VPC in your region. Ensure that you have a default VPC available in the region where you're trying to create the stack.

  3. Review error messages: When the stack creation fails, CloudFormation provides error messages. These messages often contain valuable information about what went wrong. Check the Events tab in the CloudFormation console for your stack to see detailed error messages.

  4. Examine nested stacks: If your template includes nested stacks, the failure might be occurring in one of these. You may need to dig deeper into the nested stack events to identify the root cause of the failure.

  5. Preserve resources on failure: When creating your stack, consider setting the "Stack failure options" to "Preserve successfully provisioned resources". This will allow you to inspect the state of resources that were successfully created before the failure occurred.

  6. Check resource permissions: Ensure that your IAM user or role has the necessary permissions to create all the resources defined in your template.

  7. Update existing resources: If you're updating an existing stack rather than creating a new one, make sure you're using the update stack operation instead of create stack.

If you're still encountering issues after these steps, you may need to review the specific resources being created in your template and ensure they're correctly configured. Without seeing the exact error message you're receiving, it's difficult to pinpoint the exact cause of the failure.

Remember, CloudFormation templates can be complex, and errors can occur for various reasons. Careful review of the template and error messages is often necessary to resolve issues.

Sources
Not able to create a stack on AWS cloudformation | AWS re:Post
Examples of CloudFormation stack operation commands for the AWS CLI and PowerShell - AWS CloudFormation
Troubleshoot failure to create nested stack | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.