Domain Bought on Other Provider - Production 🌐
In this guide, we’ll walk you through setting up the subdomain api.yourdomain for production. We'll assume that you’ve already purchased the domain through GoDaddy, but the steps can be applied to any other domain provider as well.
Setting Up DNS for Production 🚀
Now that we’ve successfully bought the domain, it’s time to set things up for production!
Step 1: Update cdk-stack.ts ⚙️
Go to cdk/lib/cdk-stack.ts and uncomment ACMStack

Go below and uncomment the ECSStack part

Step 2: Update acm-stack.ts ⚙️
Go to cdk/lib/acm-stack.ts and uncomment the line 28 and comment out line 27

Step 3: Update ecs-stack.ts ⚙️
Go to cdk/lib/nested/ecs-stack.ts and update accordingly. It's just a matter of commenting out and uncommenting.




Step 4: Configure Your .env File 📝
Now, let’s configure your .env file for production.
- Go to cdk/.env.
- Uncomment the Production section. Staging part should be commented out.
- Add your domain name value for the production environment. Don't add https://
For example,

Step 5: Destroy Previous Stacks 🧹
Before we deploy the new changes, let’s clean up the old stacks:
- Run aws sso login --profile awslaunchgoat-prodto log in.
- Run cdk destroy --qualifier launchgoat --profile awslaunchgoat-prodto delete any previously deployed stacks.
Step 6: Bootstrap and Deploy 🚀
Now that we’ve cleaned up the old stacks, let’s bootstrap and deploy the production environment:
- Run cdk bootstrap --qualifier launchgoat --profile awslaunchgoat-prodto prepare your AWS environment.
- Then, run cdk deploy --qualifier launchgoat --require-approval never --profile awslaunchgoat-prodto deploy the new stack.
- Don't wait until it's finished, go to Step 7 right now.
Step 7: Very Important Part!!
After running cdk deploy, our code creates a new hosted zone for yourdomain in Route 53.

However, the deployment won’t complete and gets stuck because your domain provider, such as GoDaddy, controls the DNS and is unaware of the existence of subdomains like api.awslaunchgoat.com that we just created in AWS.
Search for Route 53 in the AWS Management Console, go to the Hosted zones tab, then click on your Hosted zone name and copy the values for the NS record.

Step 8: Add NS Record
Now go to your DNS provider, which in our case is GoDaddy. We will start adding a new NS record, one by one.

Choose type NS, enter api in the name field, and paste the value in the value field.

Add the remaining NS values.

Once you've added all the NS values, the DNS will propagate, and your cdk deploy will complete successfully.
Navigate to your production URL, which should be: https://api.yourdomain (opens in a new tab)
For example, in my case, it would be: https://api.awslaunchgoat.com

Congratulations! 🎉
You’ve successfully set up your DNS with HTTPS! Your API is now:
- Securely accessible via HTTPS.
- Load-balanced across your containers for better performance and reliability.
Isn’t that awesome? 😄 You’ve got a secure and scalable setup ready for production!