AWS SES Update - Invalid JSON received Error

0

I keep getting this error even though my JSON file says valid JSON in the formatter when I try to update the email template in SES

{ "Template": { "TemplateName": "LinuxVMEmail", "SubjectPart": "Elasticpath Training Instance Details", "HtmlPart": "<html><head></head> <body>Hi {{first_name}}, <br/><br/>This email has been auto generated to provide you with information and details you will need to access your requested training work environment (Virtual Machine or VM). This environment enables you to work through any hands-on exercises for your online or classroom courses. <u>This email contains important information, so be sure to keep it until you have finished your work.</u> <br/><br/><b>This environment is only available for 1 day(s), so you will need to complete the course within this timeframe. After this timespan, your VM will be automatically terminated</b>.<br/><br/>This training environment is Linux based. <u>You will need to use SSH and VNC to connect</u>. If you do not have a VNC client, see instructions below. <h3>Your VM Credentials:</h3> <b>Hostname (PC Name):</b> {{dns_entry}}<br/> <b>Username:</b> ec2-user <br/> <b>Password:</b> El4stic123 <br/> <b>Region:</b> {{aws_region}}<br/><b>Instance Id:</b> {{instance_id}}<br/><b>Elastic Path Commerce Release Version:</b> {{release}} <br/><br/><h2>HOW TO CONNECT:</h2>Follow these insructions to conect to the machine:<h3>Mac:</h3> <ul><li>Install <a href=https://www.realvnc.com/en/connect/download/viewer>VNC Viewer</a> on your machine.</li><li>Open the VNC client and connect to <i><b>HOSTNAME:5901</b></i> with the password provided above. Leave the <b>username empty</b></li></ul><h3>Windows:</h3><ul><li>Install <a href=https://www.realvnc.com/en/connect/download/viewer>VNC Viewer</a> on your machine.</li><li>Open the VNC client and connect to <i><b>HOSTNAME:5901</b></i> with the password above. Leave the <b>username empty</b>.</li></ul><b>Happy Learning</b>,<br/><br/>The Elastic Path Education Team</body></html>", "TextPart": "Elasticpath Training Instance Details email-linux-vm-details Hi {{first_name}}, This email has been auto generated to provide you with information and details you will need to access your requested training work environment (Virtual Machine or VM). This environment enables you to work through any hands-on exercises for your online or classroom courses. This email contains important information, so be sure to keep it until you have finished your work.This environment is only available for 1 day(s), so you will need to complete the course within this timeframe. After this timespan, your VM will be automatically terminated. The training environment is Linux based. You will need to use SSH and VNC to connect. If you do not have a VNC client, see instructions below." } }

asked 2 years ago2690 views
3 Answers
0

If you're using The AWS CLI to update it, it looks like the JSON doesn't need that element Template and instead the 4 contained elements. (TemplateName, SubjectPart, TextPart, HtmlPart)

answered 2 years ago
  • I tried removing the element Template, but I still get the same error below: "Error parsing parameter 'cli-input-json': Invalid JSON received."

0

Are you using AWS CLI to perform the update? If that is the case a way to perform the command is passing a stringified JSON to the parameter --template. like this:

aws ses update-template --template "{"TemplateName":"LinuxVMEmail","SubjectPart":"Elasticpath Training Instance Details","TextPart":"Elasticpath Training Instance Details email-linux-vm-details Hi {{first_name}}, This email has been auto generated to provide you with information and details you will need to access your requested training work environment (Virtual Machine or VM). This environment enables you to work through any hands-on exercises for your online or classroom courses. This email contains important information, so be sure to keep it until you have finished your work.This environment is only available for 1 day(s), so you will need to complete the course within this timeframe. After this timespan, your VM will be automatically terminated. The training environment is Linux based. You will need to use SSH and VNC to connect. If you do not have a VNC client, see instructions below.","HtmlPart":"<html><head></head> <body>Hi {{first_name}}, <br/><br/>This email has been auto generated to provide you with information and details you will need to access your requested training work environment (Virtual Machine or VM). This environment enables you to work through any hands-on exercises for your online or classroom courses. <u>This email contains important information, so be sure to keep it until you have finished your work.</u> <br/><br/><b>This environment is only available for 1 day(s), so you will need to complete the course within this timeframe. After this timespan, your VM will be automatically terminated</b>.<br/><br/>This training environment is Linux based. <u>You will need to use SSH and VNC to connect</u>. If you do not have a VNC client, see instructions below. <h3>Your VM Credentials:</h3> <b>Hostname (PC Name):</b> {{dns_entry}}<br/> <b>Username:</b> ec2-user <br/> <b>Password:</b> El4stic123 <br/> <b>Region:</b> {{aws_region}}<br/><b>Instance Id:</b> {{instance_id}}<br/><b>Elastic Path Commerce Release Version:</b> {{release}} <br/><br/><h2>HOW TO CONNECT:</h2>Follow these insructions to conect to the machine:<h3>Mac:</h3> <ul><li>Install <a href=https://www.realvnc.com/en/connect/download/viewer>VNC Viewer</a> on your machine.</li><li>Open the VNC client and connect to <i><b>HOSTNAME:5901</b></i> with the password provided above. Leave the <b>username empty</b></li></ul><h3>Windows:</h3><ul><li>Install <a href=https://www.realvnc.com/en/connect/download/viewer>VNC Viewer</a> on your machine.</li><li>Open the VNC client and connect to <i><b>HOSTNAME:5901</b></i> with the password above. Leave the <b>username empty</b>.</li></ul><b>Happy Learning</b>,<br/><br/>The Elastic Path Education Team</body></html>"}"

answered 2 years ago
0

To ensure that the JSON is formatted correctly, you can use the --generate-cli-skeleton option, as follows:

aws ses create-template --generate-cli-skeleton > mytemplate.json

Then edit the JSON accordingly. For example:

{
    "Template": {
        "TemplateName": "LinuxVMEmail",
        "SubjectPart": "Example Subject",
        "TextPart": "Example Text",
        "HtmlPart": "Example HTML"
    }
}

Next, create the template as follows (if it has not already been created):

aws ses create-template --cli-input-json file://mytemplate.json

If the template has already been created use:

aws ses update-template --cli-input-json file://mytemplate.json

Note that update-template will not work if TemplateName does not match an already existing template. For more information, see: Part 2: Create an email template

AWS
answered 2 years 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.

Guidelines for Answering Questions