AWS CloudFormation : ValidateTemplate failed: TemplateURL must reference a valid S3 object to which you have access

You encounter the error ” ValidateTemplate failed: TemplateURL must reference a valid S3 object to which you have access ” when using AWS CloudFormation. This blog post illustrates what are the scenarios which throw this error.

 

Difficulty with the Error Message

Both the options of using CloudFormation upload will throw the same error message. The thing to note here is it is the same error but it is due to different operation. This is due to non-accessibility of the S3 backup, so by extension, even if you upload a cloud formation template from your local machine, it still goes to the S3 bucket and then fed to CloudFormation Engine.

Upload File Error

Provide Template URL error

Scenarios

  1. When You Upload a template file with its file name containing space.  To solve it just re-name the file without spaces.
  2. You can pick the the S3 URL of the sample CloudFormation templates, however you should ensure the S3’s region is same as your target CloudFormation region in the portal / console.

Advertisements
Categories AWS

4 thoughts on “AWS CloudFormation : ValidateTemplate failed: TemplateURL must reference a valid S3 object to which you have access

  1. Hi Naveen,

    The post is helpful and I have a question about creating the application stack. I am getting the same error (as mentioned in the post) when I tried to create an application stack by uploading the empty template file from my local machine. What is the reason behind it>

    Like

  2. Dinesh,

    The CloudFormation template consists of entities like Version, Mapping, Parameters, Resources. Of that Resources is the mandatory. Try creating the template with a resource.

    By the way why do you want to create a Cloud Formation Template without any value i.e. empty template?

    Like

  3. Hi Naveen,

    When I check the Properties of my S3 bucket, it lists the region as “US Standard”, which as far as i know is not the name of any EC2 region. Furthermore, when I click 'Global' at the top right of the S3 console, it says “S3 does not require region selection.”

    Does this mean S3 buckets are no longer region-specific? I'm getting a “TemplateURL must reference a valid S3 object to which you have access” error anyway. When I type the same URL into my browser it downloads the template without issue.

    Like

  4. Hello Mike,

    “The US Standard Region automatically routes requests to facilities in Northern Virginia or the Pacific Northwest using network maps.”

    The S3 buckets take the region parameter as a input when create it via API/Management Console. The design of S3 in Management Console is in such a way, you can access all the buckets for your subscription across all the regions. To support this point, you can try creating a bucket via the Management console and you will be prompted for the “Region”.

    So, the best thing to do to avoid all these mess is decide on the region for infra setup and then create a bucket in the same region and then to go ahead with the CloudFormation.

    Other way is to upload the CFN template and anyway it will upload it to S3 and only then deploy it.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s