Deploy the Self Mail Kit
Deploy the Self Mail Kit
1. Clone the repository
2. Install dependencies
3. Update the environment variables
a. Go to the config/.env.base
file and update the env variables. There’s no sensitive information in this file. All sensitive information is stored in AWS Secrets Manager.
b. Go to the config/.env.production
file and update the AWS account ID and region.
4. Deploy the self mail kit
a. We need AWS credentials since we deploy from our local machine. Open your AWS access portal URL. You can find the URL in your email when you create a new user. Open the prod
account (or the main account) and go to the Command line or programmatic access
tab.
You will get a root user password for the dashboard. When you login, you will be asked to change the password. That’s it!
A pop-up will open. Choose your OS (macOS and Linux, Windows, PowerShell) and copy the values from option 1, AWS environment variables (Short-term credentials). These credentials are called short-term credentials because they expire after some hours, depending on your session hours.
b. Open your terminal and paste the values. The credentials are valid only for the current terminal session. If you close the terminal, you need to repeat the same steps.
c. Bootstrap the AWS CDK toolkit for the prod account.
Remember to bootstrap the AWS CDK toolkit for the us-east-1
region, even if your region differs. We use us-east-1
for the domain and certificate management.
d. From the root directory, run the following command to deploy. You’re required to manually add the name servers (only first time deployment) to your domain after running make deploy-prod
.
The deployment will run for a few minutes. If it gets stuck in a step that says 1/3 Currently in progress
, it means we need to configure the name servers. We will do that in the next step.
The stack deployment will not continue until you perform the actions below. It awaits for the validation and after configuring the name servers, it will automatically continue.
Grab the name servers (four records) from AWS (Go to Route 53 and click on the hosted zone).
Add the name servers to your domain.
For example, I used to use Google Domains (RIP…) for my domain. That’s how it looked in Google Domains. It’s the same for other domain providers.
That’s it! After you update the DNS records, the rest of the deployment will continue. It will configure everything and you will receive an email with the temporary password for the dashboard. When you login, you will be asked to change the password.
Remember to request AWS SES production access if your account is new. If it takes time, contact us, and we will help you get production access!
Happy email sending! 🚀
If you want to deploy to the dev account, repeat the steps above with the dev account. The only difference is you add your dev domain NS records to your AWS prod account (Route 53), because your root domain is now managed by AWS.