1 Answer
- Newest
- Most votes
- Most comments
0
Hi,
Actually, in one of my projects I have developed somehow the same logic. I configured SES for sending emails and have used Lambda for sending emails via SES. I have developed the SES configuration in Terraform. I have already checked this solution for sending to Yahoo, Gmail, Hotmail, and some company email addresses.
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.20.1"
}
}
backend "s3" {
bucket = "my-bucket-name"
key = "ses/terraform.tfstate"
region = "my-region"
}
}
provider "aws" {
region = "my-region"
}
variable "domainname" {
type = string
default = "my-domain-name.com"
}
data "aws_route53_zone" "default" {
name = var.domainname
private_zone = false
}
resource "aws_ses_domain_identity" "domain" {
domain = var.domainname
}
#----------------------------------------------------
# Domain Verification Record
#----------------------------------------------------
resource "aws_route53_record" "example_amazonses_verification_record" {
zone_id = data.aws_route53_zone.default.zone_id
name = "_amazonses.${aws_ses_domain_identity.domain.id}"
type = "TXT"
ttl = "300"
records = [aws_ses_domain_identity.domain.verification_token]
}
resource "aws_ses_domain_identity_verification" "example_verification" {
domain = aws_ses_domain_identity.domain.id
depends_on = [aws_route53_record.example_amazonses_verification_record]
}
#----------------------------------------------------
# DKIM Record Set
#----------------------------------------------------
resource "aws_ses_domain_dkim" "example" {
domain = aws_ses_domain_identity.domain.domain
}
resource "aws_route53_record" "example_amazonses_dkim_record" {
count = 3
zone_id = data.aws_route53_zone.default.zone_id
name = "${element(aws_ses_domain_dkim.example.dkim_tokens, count.index)}._domainkey"
type = "CNAME"
ttl = "300"
records = ["${element(aws_ses_domain_dkim.example.dkim_tokens, count.index)}.dkim.amazonses.com"]
}
answered a year ago
Relevant content
- asked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 months ago