Introduction
In my previous IAM article we learnt basics of IAM and how to create Users, Groups and attach Policies. You can refer here:
Step 2: Launch a New EC2 Instance
On the left-hand side panel:
- Click on Instances
- Then click on Launch Instance (top-right corner)
- You will now enter the Launch Instance configuration page.
Step 3: Configure the EC2 Instance
1. Give Your Instance a Name: Under the Name and Tags section, provide a name for your instance. Example: My-First-Instance
2. Choose an Operating System: Under Application and OS Images (Amazon Machine Image) select the operating system.
For this practice, I selected: Ubuntu
3. Create a Key Pair: The Key Pair is extremely important because it is used to securely log in to your EC2 instance.
- Click on Create new key pair
- Give the key pair a name
- Download the .pem file
Note: Keep this .pem file safe because it cannot be downloaded again.
And for now, we will not touch the security part and other parts, just keep it as it is and then click on "Launch Instance".
Step 4: Verify the Instance is Running
Once the instance is launched:
- Open the instance
- Ensure the Instance State is Running
- Click on the Instance ID to view complete details.
- We will use the Public IPv4 Address to access the server and application. Example: 32.197.45.191
Step 5: Connect to EC2 Instance Using SSH
Open your terminal.
Depending on your operating system, you can use:
- Git Bash (Windows)
- PuTTY
- MobaXterm
- Default Terminal (Mac/Linux)
For this practice, I will use Git Bash.
Navigate to the Download Folder: Move to the folder where the .pem file was downloaded like below image.
Step 9: Update Packages
Before installing any software, always update the server packages.
If Logged in as Ubuntu User
sudo apt update
If Logged in as Root User, type "apt update"
Once this is done, lets now try to deploy an Jenkins application from here.
Step 10: Install Jenkins
Now let’s deploy an application on the EC2 instance.
We will install Jenkins.
Visit the official Jenkins website
Copy the Ubuntu installation commands from the website and execute them in the terminal.
Step 11: Verify Jenkins Service Status
After installation, check Jenkins status:
systemctl status jenkins
If Jenkins is not active, also if you are getting any error for inactive you can also check the java version, it works best with java 21 version. So if the java isn't in this version try updating the version.
Also restart the service:
systemctl restart jenkins
Then check the status again.
Step 12: Access Jenkins from Browser
Copy the Public IP Address from your EC2 instance.
Open a browser and access Jenkins using:
http://<Public-IP>:8080
Initially, the application may not open because port 8080 is blocked in the Security Group
Step 13: Configure Security Group for Jenkins
To allow access to Jenkins:
- Open the EC2 Instance
- Scroll down to the Security section
- Click on the attached Security Group
Then click: Save Rules
Step 14: Open Jenkins Again
Now refresh the browser:
http://<Public-IP>:8080
Step 15: Retrieve Jenkins Initial Password
Run the following command inside the EC2 terminal:
cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it into the Jenkins browser page.
You will now enter the Jenkins dashboard.
Congratulations! 🎉🥳
You have successfully:
- Launched your first EC2 instance
- Connected to it using SSH
- Managed secure access using a .pem key
- Installed Jenkins
- Configured Security Groups
- Deployed and accessed your first application on AWS
I hope this article helped you in knowing the basics of EC2 and and also how to deploy an Application in EC2.
Let's meet in next article with another service of AWS!!!

SOCIAL SHARE CARD GENERATOR