Securely manage AWS credentials for your TrackPost integration. This guide covers IAM user creation, permissions, and security best practices.
Table of Contents
Overview
TrackPost connects to AWS SES using IAM (Identity and Access Management) credentials. This guide ensures your setup is both functional and secure.
Why Use IAM?
- Least Privilege - Grant only necessary permissions
- Audit Trail - Track API usage via CloudTrail
- Credential Rotation - Easy to rotate keys regularly
- No Root Access - Never use root account credentials
Creating an IAM User
Step 1: Access IAM Console
- Log in to AWS Console
- Navigate to IAM → Users
- Click Create user
Step 2: Configure User Details
- User name:
trackpost-ses(or any descriptive name) - Access type: Select Access key - Programmatic access
- Click Next: Permissions
Step 3: Set Permissions
Option A: Attach Policy Directly (Recommended)
- Select Attach policies directly
- Click Create policy
- Go to JSON tab
- Paste this policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ses:SendEmail",
"ses:SendRawEmail",
"ses:GetSendQuota",
"ses:GetIdentityVerificationAttributes",
"ses:GetIdentityNotificationAttributes",
"ses:VerifyEmailIdentity",
"ses:VerifyDomainIdentity",
"ses:SetIdentityNotificationTopic",
"ses:SetIdentityFeedbackForwardingEnabled",
"ses:DescribeConfigurationSet"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"sns:CreateTopic",
"sns:Subscribe",
"sns:Publish",
"sns:ConfirmSubscription",
"sns:GetTopicAttributes"
],
"Resource": "*"
}
]
}
- Click Next: Tags
- Add optional tags (e.g.,
Project=TrackPost,Environment=Production) - Click Next: Review
- Name the policy:
TrackPostSESAccess - Click Create policy
- Go back to user creation and attach this policy
Option B: Add to Group (For Multiple Users)
If you have multiple users managing TrackPost:
- Create a group: IAM → User groups → Create group
- Name:
TrackPostAdmins - Attach the policy above
- Add users to this group
Step 4: Review and Create
- Review the user details
- Click Create user
- Important: On the success page, you’ll see:
- Access key ID (e.g.,
AKIAIOSFODNN7EXAMPLE) - Secret access key (click “Show” to reveal)
- Access key ID (e.g.,
- Download the CSV or copy these credentials immediately
- Click Close
Warning
Critical: This is the only time you’ll see the secret access key. Store it securely (password manager, encrypted file). If lost, you’ll need to create new credentials.
Adding Credentials to TrackPost
Via Dashboard
- Log in to TrackPost Dashboard
- Go to Settings → AWS Configuration
- Enter:
- Access Key ID: From IAM user creation
- Secret Access Key: From IAM user creation
- AWS Region: Your preferred SES region
- Click Save
- Click Test Connection to verify
Via CLI
trackpost aws setup
# Follow interactive prompts to enter credentials
AWS Regions
Choose an AWS region close to your users:
| Region | Code | Location | Best For |
|---|---|---|---|
| US East (N. Virginia) | us-east-1 | USA | US East Coast |
| US West (Oregon) | us-west-2 | USA | US West Coast |
| Europe (Ireland) | eu-west-1 | Europe | Western Europe |
| Europe (Frankfurt) | eu-central-1 | Europe | Central Europe |
| Asia Pacific (Singapore) | ap-southeast-1 | Asia | Southeast Asia |
| Asia Pacific (Tokyo) | ap-northeast-1 | Asia | Japan |
| Asia Pacific (Sydney) | ap-southeast-2 | Australia | Australia/NZ |
| South America (São Paulo) | sa-east-1 | Brazil | South America |
Regional Considerations
- Latency: Choose closest to your users
- Compliance: Some regions have different compliance standards
- Pricing: Varies slightly by region
- SES Availability: SES is available in most regions
Security Best Practices
1. Never Use Root Account
- Always create IAM users with limited permissions
- Root account has unrestricted access to your entire AWS account
2. Rotate Credentials Regularly
Recommended Schedule: Every 90 days
How to Rotate:
Create new access keys for the IAM user:
- IAM → Users →
trackpost-ses→ Security credentials - Click Create access key
- Copy new credentials
- IAM → Users →
Update TrackPost with new credentials:
- Dashboard → Settings → AWS Configuration
- Update Access Key ID and Secret Access Key
- Save and test
Deactivate old keys:
- IAM → Users →
trackpost-ses→ Security credentials - Find old access key
- Click Actions → Deactivate
- Wait 24 hours to ensure no issues
- Click Actions → Delete
- IAM → Users →
3. Use Environment Variables (Never Hardcode)
❌ Don’t do this:
const client = new TrackPostClient({
apiKey: 'tp_live_abc123',
awsAccessKeyId: 'AKIA...', // ❌ Hardcoded!
awsSecretAccessKey: 'secret...' // ❌ Hardcoded!
});
✅ Do this instead:
// .env file (add to .gitignore!)
TRACKPOST_AWS_ACCESS_KEY_ID=AKIA...
TRACKPOST_AWS_SECRET_ACCESS_KEY=secret...
// Your code
const client = new TrackPostClient({
apiKey: process.env.TRACKPOST_API_KEY,
awsAccessKeyId: process.env.TRACKPOST_AWS_ACCESS_KEY_ID,
awsSecretAccessKey: process.env.TRACKPOST_AWS_SECRET_ACCESS_KEY
});
4. Enable CloudTrail for Audit
Track API usage:
- Go to CloudTrail in AWS Console
- Click Create trail
- Name:
TrackPostAudit - Enable logging for SES and SNS events
- Store logs in S3 for review
5. Use AWS Secrets Manager (Optional)
For enhanced security, store credentials in AWS Secrets Manager:
- Secrets Manager → Store a new secret
- Secret type: Other type of secret
- Add key-value pairs:
accessKeyId: Your access keysecretAccessKey: Your secret key
- Name:
trackpost/aws-credentials - TrackPost can retrieve these programmatically
6. Monitor with CloudWatch
Set up alerts for:
- High bounce rates
- Unusual sending volumes
- SES configuration changes
CloudWatch Alarms:
- Go to CloudWatch → Alarms → Create alarm
- Select SES metrics
- Set thresholds for your use case
Credential Troubleshooting
“Invalid credentials” Error
Check:
- Access Key ID and Secret Access Key are correct
- No extra spaces or characters
- IAM user still exists and is active
- Credentials are for the correct AWS account
“Access denied” Error
Check:
- IAM policy attached to user
- Policy includes all required actions (SES and SNS)
- User is not in a group with restrictive policies
- No explicit “Deny” statements in policies
“Token has expired” Error
Temporary credentials (from STS) have expired. For TrackPost, use long-term access keys, not temporary session tokens.
Credentials Not Working in Specific Region
Check:
- SES is available in the selected region
- Your account has SES access in that region
- IAM permissions are region-agnostic (they usually are)
Multi-Account Setup
If you manage multiple TrackPost workspaces or environments:
Separate IAM Users per Environment
| Environment | IAM User | Purpose |
|---|---|---|
| Production | trackpost-ses-prod | Live application |
| Staging | trackpost-ses-staging | Testing environment |
| Development | trackpost-ses-dev | Local development |
Cross-Account Access (Advanced)
If your TrackPost account is in a different AWS account than SES:
- Create IAM role in SES account:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::TRACKPOST_ACCOUNT_ID:root"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "your-external-id"
}
}
}
]
}
- Attach SES permissions to this role
- Configure TrackPost to assume this role
Credential Storage Options
Option 1: TrackPost Dashboard (Default)
- Credentials stored encrypted in TrackPost database
- Easy to update via dashboard
- Good for most use cases
Option 2: Environment Variables
export TRACKPOST_AWS_ACCESS_KEY_ID=AKIA...
export TRACKPOST_AWS_SECRET_ACCESS_KEY=secret...
export TRACKPOST_AWS_REGION=us-east-1
Option 3: AWS Secrets Manager
More secure, but requires additional setup:
// Retrieve from Secrets Manager
const secret = await secretsManager
.getSecretValue({ SecretId: 'trackpost/aws-credentials' })
.promise();
const credentials = JSON.parse(secret.SecretString);
Comparison
| Method | Security | Convenience | Best For |
|---|---|---|---|
| Dashboard | Medium | High | Most users |
| Environment Variables | Medium | Medium | CI/CD, containers |
| Secrets Manager | High | Low | Enterprise security |
Next Steps
- Domain Setup - Verify your sending domain
- Deliverability - Configure SPF, DKIM, DMARC
- Security Best Practices - Common security pitfalls
- CLI Setup - Configure AWS via CLI