Skip to content

Commit 0f736ed

Browse files
sean-navapbcSean Thomasclaude
authored
942 replace pinpoint with SES (#231)
* 942 replace pinpoint with SES * updates to access_control * Replace Pinpoint outputs with SES outputs - Replace pinpoint_app_id output with ses_configuration_set and ses_from_email - Updates outputs for all app templates (app, app-flask, app-nextjs, app-rails) - Completes migration from Amazon Pinpoint to direct SES usage Related to Amazon Pinpoint end of support (October 30, 2026) See: https://docs.aws.amazon.com/pinpoint/latest/userguide/migrate.html 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Address PR feedback * [942] Remove unused outputs from notifications-email-domain modules * Update `template-infra:base` to version 0.15.7.post1.dev0+4ebae27 * app: Update `template-infra:app` to version 0.15.7.post1.dev0+4ebae27 * app-flask: Update `template-infra:app` to version 0.15.7.post1.dev0+4ebae27 * app-nextjs: Update `template-infra:app` to version 0.15.7.post1.dev0+4ebae27 * app-rails: Update `template-infra:app` to version 0.15.7.post1.dev0+4ebae27 --------- Co-authored-by: Sean Thomas <sean.thomas@navapbc.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4e434b9 commit 0f736ed

File tree

33 files changed

+94
-151
lines changed

33 files changed

+94
-151
lines changed

.template-infra/app-app-flask.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.15.6-18-gc477511
2+
_commit: v0.15.7-1-g4ebae27
33
_src_path: https://github.com/navapbc/template-infra
44
app_has_dev_env_setup: true
55
app_local_port: 3200

.template-infra/app-app-nextjs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.15.6-18-gc477511
2+
_commit: v0.15.7-1-g4ebae27
33
_src_path: https://github.com/navapbc/template-infra
44
app_has_dev_env_setup: true
55
app_local_port: 3300

.template-infra/app-app-rails.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.15.6-18-gc477511
2+
_commit: v0.15.7-1-g4ebae27
33
_src_path: https://github.com/navapbc/template-infra
44
app_has_dev_env_setup: true
55
app_local_port: 3100

.template-infra/app-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.15.6-18-gc477511
2+
_commit: v0.15.7-1-g4ebae27
33
_src_path: https://github.com/navapbc/template-infra
44
app_has_dev_env_setup: true
55
app_local_port: 3000

.template-infra/base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.15.6-18-gc477511
2+
_commit: v0.15.7-1-g4ebae27
33
_src_path: https://github.com/navapbc/template-infra
44
base_code_repository_url: git@github.com:navapbc/platform-test.git
55
base_default_region: us-east-1

app/notifications.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,28 @@
22
import boto3
33

44
def send_email(to: str, subject: str, message: str):
5-
pinpoint_client = boto3.client("pinpoint")
6-
app_id = os.environ["AWS_PINPOINT_APP_ID"]
5+
ses_client = boto3.client("sesv2")
6+
from_email = os.environ["AWS_SES_FROM_EMAIL"]
77

8-
response = pinpoint_client.send_messages(
9-
ApplicationId=app_id,
10-
MessageRequest={
11-
"Addresses": {
12-
to: {
13-
"ChannelType": "EMAIL"
14-
}
15-
},
16-
"MessageConfiguration": {
17-
"EmailMessage": {
18-
"SimpleEmail": {
19-
"Subject": {
20-
"Charset": "UTF-8",
21-
"Data": subject
22-
},
23-
"HtmlPart": {
24-
"Charset": "UTF-8",
25-
"Data": message
26-
},
27-
"TextPart": {
28-
"Charset": "UTF-8",
29-
"Data": message
30-
}
8+
response = ses_client.send_email(
9+
FromEmailAddress=from_email,
10+
Destination={
11+
"ToAddresses": [to]
12+
},
13+
Content={
14+
"Simple": {
15+
"Subject": {
16+
"Data": subject,
17+
"Charset": "UTF-8"
18+
},
19+
"Body": {
20+
"Html": {
21+
"Data": message,
22+
"Charset": "UTF-8"
23+
},
24+
"Text": {
25+
"Data": message,
26+
"Charset": "UTF-8"
3127
}
3228
}
3329
}

docs/infra/notifications.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
The application may need to send email notifications to users. This document describes how to configure notifications. The notification setup process will:
44

5-
1. Create an AWS Pinpoint application for managing notifications
6-
2. Configure Amazon SES (Simple Email Service) for sending emails
5+
1. Configure Amazon SES (Simple Email Service) for sending emails
6+
2. Set up the necessary IAM permissions for SES access
77
3. Set up the necessary environment variables for the application service
88

99
## Requirements
@@ -32,28 +32,35 @@ make infra-update-app-service APP_NAME=<APP_NAME> ENVIRONMENT=<ENVIRONMENT>
3232

3333
## 4. Send a test email
3434

35-
To send a test notification using the AWS CLI, first get the application id for the Pinpoint application/project for the environment you want to test.
35+
To send a test notification using the AWS CLI, first get the sender email address for the environment you want to test.
3636

3737
```bash
3838
bin/terraform-init "infra/<APP_NAME>/service" "<ENVIRONMENT>"
39-
APPLICATION_ID="$(terraform -chdir=infra/<APP_NAME>/service output -raw pinpoint_app_id)"
39+
FROM_EMAIL="$(terraform -chdir=infra/<APP_NAME>/service output -raw ses_from_email)"
4040
```
4141

4242
Then run the following command, replacing `<RECIPIENT_EMAIL>` with the email address you want to send to:
4343

4444
```bash
45-
aws pinpoint send-messages --application-id "$APPLICATION_ID" --message-request '{
46-
"Addresses": {
47-
"<RECIPIENT_EMAIL>": { "ChannelType": "EMAIL" }
48-
},
49-
"MessageConfiguration": {
50-
"EmailMessage": {
51-
"SimpleEmail": {
52-
"Subject": { "Data": "Test notification", "Charset": "UTF-8" },
53-
"TextPart": { "Data": "This is a message from the future", "Charset": "UTF-8" },
54-
"HtmlPart": { "Data": "This is a message from the future", "Charset": "UTF-8" }
45+
aws sesv2 send-email \
46+
--from-email-address "$FROM_EMAIL" \
47+
--destination "ToAddresses=<RECIPIENT_EMAIL>" \
48+
--content '{
49+
"Simple": {
50+
"Subject": {
51+
"Data": "Test notification",
52+
"Charset": "UTF-8"
53+
},
54+
"Body": {
55+
"Text": {
56+
"Data": "This is a message from the future",
57+
"Charset": "UTF-8"
58+
},
59+
"Html": {
60+
"Data": "<p>This is a message from the future</p>",
61+
"Charset": "UTF-8"
62+
}
5563
}
56-
}
57-
}
58-
}'
64+
}
65+
}'
5966
```

docs/system-architecture.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ This diagram shows the system architecture. [🔒 Make a copy of this Lucid temp
1616
* **GitHub** — Source code repository. Also responsible for Continuous Integration (CI) and Continuous Delivery (CD) workflows. GitHub Actions builds and deploys releases to an Amazon ECR registry that stores Docker container images for the application service.
1717
* **Incident Management Service** — Incident management service (e.g. PagerDuty or Splunk On-Call) for managing on-call schedules and paging engineers for urgent production issues.
1818
* **NAT Gateway** — Enables outbound internet access for resources in private subnets.
19-
* **Pinpoint** — Amazon Pinpoint service used for sending email and SMS notifications to users.
2019
* **Secrets Manager** — Securely stores and retrieves sensitive information such as database credentials.
2120
* **Service** — Amazon ECS service running the application.
22-
* **SES** — Amazon SES used by Amazon Pinpoint for sending email notifications.
21+
* **SES** — Amazon Simple Email Service (SES) used for sending email notifications to users.
2322
* **Terraform Backend Bucket** — Amazon S3 bucket used to store terraform state files.
2423
* **Terraform State Locks DynamoDB Table** — Amazon DynamoDB table used to manage concurrent access to terraform state files.
2524
* **VPC Endpoints** — VPC endpoints are used by the Database Role Manager to access Amazon Services without traffic leaving the VPC.

infra/app-flask/app-config/env-config/notifications.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Notifications configuration
22
locals {
33
notifications_config = var.enable_notifications && var.domain_name != null && local.network_config.domain_config.hosted_zone != null ? {
4-
# Pinpoint app name.
4+
# Notification configuration name.
55
name = "${var.app_name}-${var.environment}"
66

77
# Configure the name that users see in the "From" section of their inbox,

infra/app-flask/app-config/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ locals {
3939
# If either (domain name or hosted zone) is not set in an environment, notifications will not actually be enabled.
4040
#
4141
# If enabled:
42-
# 1. Creates an AWS Pinpoint application
43-
# 2. Configures email notifications using AWS SES
42+
# 1. Configures AWS SES for sending email notifications
43+
# 2. Sets up IAM permissions for the application to send emails
4444
enable_notifications = false
4545

4646
# Whether or not the application should enable WAF for the load balancer.

0 commit comments

Comments
 (0)