I have been developing backend services for about 3 years and have always deployed them on in-house servers. Deploying a backend service on AWS for the first time can be both exciting and intimidating. For me, the experience was filled with moments of triumph, a few roadblocks, and a lot of learning. In this article, I’ll walk you through my journey of deploying a backend service on AWS, including the challenges I faced and how I solved them.
NB: This article is also available on for my PostgreSQL database and , a reliable database management tool, to connect to the RDS instance. After verifying the connection and running some test queries, I was confident that the database setup was solid. I proceeded to provide the database URL and credentials in the application properties file.
Launching the EC2 Instance
Next, I focused on the service deployment. I launched an Amazon EC2 instance running on a Linux machine and configured a security group to allow:
- The service port for external requests.
- The database port for internal communication.
- SSH access for managing the server.
Using CLI commands, I connected to the EC2 instance via SSH from my local terminal:
chmod 400 /path/to/key.pem
ssh -i /path/to/key.pem ec2-user@<EC2-public-DNS>
Once inside the EC2 instance, I installed the necessary dependencies (Java in particular), copied the jar file and deployed the service:
sudo yum install java-17-amazon-corretto
scp -i /path/to/key.pem my-service.jar ec2-user@<EC2-public-DNS>
java -jar my-service.jar
Testing the Service
Once the service was up, I tested it using the public URL provided by AWS. Tools like is an additional resource that you’d find helpful in estimating the cost of deploying your solution on AWS.
Feel free to share your thoughts or experiences in the comments. I’d love to hear how others have tackled similar challenges!
SOCIAL SHARE CARD GENERATOR