fbpx

[SOLVED]: Invalid template path ec2_instance.yml in CircleCI

If you are working in CircleCi trying to deploy AWS stack and you get an error message that says “Invalid template path” and looks like this

#!/bin/bash -eo pipefail
aws cloudformation deploy \
  --template-file ec2_instance.yml \
  --stack-name create_infrastructure-${CIRCLE_WORKFLOW_ID:0:5} \
  --region us-west-2  

Invalid template path ec2_instance.yml
Exited with code exit status 255
CircleCI received exit code 255

Here is the solution:

Move your template file from inside .circleci folder to the same folder level as .circleci

For example,

From This

Wrong CircleCI and AWS Template File Folder Level
Wrong CircleCI and AWS Template File Folder Level

To this

Right CircleCI and AWS Template File Folder Level
Right CircleCI and AWS Template File Folder Level

After you have done that,

Make sure your template file name is spelled correctly in this code block

aws cloudformation deploy \
  --template-file ec2_instance.yml \
  --stack-name create_infrastructure-${CIRCLE_WORKFLOW_ID:0:5} \
  --region us-west-2  

I hope this helped you. For more information,

Get FREE Tutorials, Free Books, plus other FREE Resources – https://www.machinelearningeducation.com/free

Follow me on twitter — https://twitter.com/evidencenmedia

Follow me on Linkedin — https://www.linkedin.com/in/evidencen/

Follow me on Github — https://github.com/EvidenceN

My Youtube Channel — https://www.youtube.com/evidencen

Support My Youtube Channel — https://www.youtube.com/channel/UCssd_k9oZ0CtC_jafMxSVOQ/join

Support my work directly and this blog — https://www.machinelearningeducation.com/support

Email/Contact me — https://evidencen.com/contact-me/

Thank you.

Leave a Comment

Scroll to Top