1 min to read
Jenkins in AWS
Here’s how we can quickly launch a Jenkins instance on AWS EC2:
🚀 Launch Jenkins on AWS EC2
- Login to AWS Console and go to the EC2 service. Click “Launch Instance.”
- Select an Amazon Machine Image:
- Amazon Linux 2 AMI (HVM), SSD Volume Type
- Choose Instance Type:
- t2.micro (free tier eligible)
- Configure Instance Details:
- Keep defaults. In “Advanced Details,” add the following user data script to install and start Jenkins automatically:
#!/bin/bash $wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo $rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key $yum install -y java jenkins $chkconfig --add jenkins $systemctl start jenkins
- Add Storage:
- We can keep the default or adjust as needed.
- Add Tags:
- (Optional) Add tags for organization.
- Configure Security Group:
- Allow SSH (port 22, source: My IP)
- Allow HTTP (port 8080, source: My IP or 0.0.0.0/0 for public access)
- Review and Launch:
- Select an existing key pair or create a new one for SSH access.
🌐 Access Jenkins
- After launch, get the public DNS of our EC2 instance.
- Access Jenkins at:
http://<Public_DNS>:8080
🔑 Unlock Jenkins
When Jenkins starts, it will prompt for an administrator password. We retrieve it by connecting to our instance:
# Connect to the instance
ssh -i <key_name>.pem ec2-user@<aws-instance-public-dns>
# Get the Jenkins admin password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
We’re now ready to finish Jenkins setup in our browser!
Comments