AWS Amazon SES Template
This page shows how to write Terraform and CloudFormation for Amazon SES Template and write them securely.
aws_ses_template (Terraform)
The Template in Amazon SES can be configured in Terraform with the resource name aws_ses_template
. The following sections describe 4 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_ses_template" "mfa_false" {
name = var.mfa_false_template
subject = "The MFA for the user {user_name} is not set yet!"
html = "<h1>Hello,</h1><p>The MFA for the user {user_name} is not set yet!</p>"
text = "The MFA for the user {user_name} is not set yet!"
}
resource "aws_ses_template" "airflow_success" {
name = "AirflowSuccess"
subject = "{{dag}} finished!"
html = "<p>Airflow {{dag}} DAG has finished succesfully.</p>"
text = "Airflow {{dag}} DAG has finished succesfully."
}
resource "aws_ses_template" "templates" {
count = length(local.templates)
name = local.templates[count.index].name
subject = file(local.templates[count.index].subject)
html = file(local.templates[count.index].html)
text = file(local.templates[count.index].text)
resource "aws_ses_template" "MyTemplate" {
name = "MyTemplate"
subject = "Greetings, {{name}}!"
html = "<h1>Hello {{name}},</h1><p>Your favorite animal is {{favoriteanimal}}.</p>"
text = "Hello {{name}},\r\nYour favorite animal is {{favoriteanimal}}."
Parameters
-
arn
optional computed - string -
html
optional - string -
id
optional computed - string -
name
required - string -
subject
optional - string -
text
optional - string
Explanation in Terraform Registry
Provides a resource to create a SES template.
AWS::SES::Template (CloudFormation)
The Template in SES can be configured in CloudFormation with the resource name AWS::SES::Template
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::SES::Template
Properties:
Template:
TemplateName: ${self:provider.requestDailyIdeaEmailTemplateName}
SubjectPart: '[Daily Idea] Idea for {{ TODAY }}'
TextPart: ${file(mail_templates/request_daily_idea/daily_idea.txt)}
Type: 'AWS::SES::Template'
Properties:
Template:
TemplateName: UsersList
SubjectPart: UsersList
TextPart:
Type: AWS::SES::Template
Properties:
Template:
TemplateName: DailyMoodSurveyEmailTemplate
SubjectPart: How was work today?
TextPart: How was work at {{companyName}} today? Rate your day
Type: AWS::SES::Template
Properties:
Type: AWS::SES::Template
Properties:
Template:
TemplateName: OhlawContactTemplate-${self:provider.stage}
SubjectPart: 'OHLaw Contact Form Submission'
TextPart: ${file(api/resources/contact_template.txt)}
"AWS::SES::Template.Template": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html",
"Properties": {
"HtmlPart": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-htmlpart",
"AWS::SES::Template.Template": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html",
"Properties": {
"HtmlPart": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-htmlpart",
"AWS::SES::Template.Template": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html",
"Properties": {
"HtmlPart": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-htmlpart",
"AWS::SES::Template.Template": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html",
"Properties": {
"HtmlPart": {
"Required": false,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ses-template-template.html#cfn-ses-template-template-htmlpart",
"Type" : "AWS::SES::Template",
"Properties" : {
"Template" : {
"TemplateName": "double-opt-in",
"SubjectPart": {
"Ref": "SESSubjectPart"
Parameters
Template
The content of the email, composed of a subject line, an HTML part, and a text-only part.
Required: No
Type: Template
Update requires: No interruption
Explanation in CloudFormation Registry
Specifies an email template. Email templates enable you to send personalized email to one or more destinations in a single API operation.
Frequently asked questions
What is AWS Amazon SES Template?
AWS Amazon SES Template is a resource for Amazon SES of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon SES Template?
For Terraform, the GSA/grace-cloudcustodian, AdastraCZ/aws_data_platform and inextensodigital/terraform-aws-ses-templates source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the dailyidea/dailyidea.com, s-beats/cdk-sample and johnkueh/dynamodb-graphql source code examples are useful. See the CloudFormation Example section for further details.