Automated Jenkins server deployment on AWS EC2 using CloudFormation
- ⚡ Automated Jenkins installation
- ☕ Java 17 pre-installed
- 📀 Configurable EBS volume
- 🔒 Available encryption options
- 🛡️ Automatic security group creation
- 🔧 AWS CLI integration
- AWS account with sufficient permissions
- AWS CLI installed and configured
- Existing SSH key pair in AWS
- VPC and Subnet configured in AWS
- Basic knowledge of AWS CloudFormation
- 🐧 AMI Base: Amazon Linux 2023
- 🏷️ AMI ID: ami-0b4624933067d393a (us-east-2)
- 🔄 Version: Amazon Linux 2023 AMI 2023.6.20241212.0 x86_64 HVM kernel-6.1
- 📦 Pre-installed Features:
- systemd 252.4
- yum package manager# 🏗️ Jenkins Server Deployment on AWS EC2
- 🐧 Base AMI: Amazon Linux 2023
- 🏷️ AMI ID: ami-0b4624933067d393a (us-east-2)
- 🔄 System Version: Amazon Linux 2023 AMI 2023.6.20241212.0 x86_64 HVM
- aws-cli v2
This implementation is optimized for Amazon Linux 2023. This distribution is recommended due to:
- Native integration with AWS services
- Cloud optimization
- Regular security updates
- LTS support
Parameter | Description | Default Value |
---|---|---|
AWSRegion | AWS Region for deployment | us-east-1 |
JenkinsInstanceType | EC2 instance type | t2.micro |
JenkinsVolumeSize | EBS volume size (GB) | 16 |
- Clone the repository:
git clone <repository-URL>
- Deploy the CloudFormation stack:
# Deploy stack
aws cloudformation create-stack \
--stack-name jenkins-server \
--template-body file://jenkins-template.yaml \
--parameters ParameterKey=KeyName,ParameterValue=mi-keypair
# Check status
aws cloudformation describe-stacks \
--stack-name jenkins-server
# Update stack
aws cloudformation update-stack \
--stack-name jenkins-server \
--template-body file://jenkins-template.yaml
# Delete stack
aws cloudformation delete-stack \
--stack-name jenkins-server
- Connect to the EC2 Instance:
ssh -i "<name-key>.pem" ec2-user@<public-ip>.<region>.compute.amazonaws.com
- Get the Jenkins Admin Password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
- Access Jenkins:
- Wait approximately 5-10 minutes after deployment.
- Access Jenkins using:
http://<public-ip>:8080
The instance is deployed with a security group that allows:
- Port 22 (SSH)
- Port 8080 (Jenkins UI) It is recommended to modify JenkinsAllowSSHFrom to restrict SSH access
sudo tail -f /var/log/deploy.log
- Automated Jenkins installation
- Support for Amazon Linux 2023
- AWS CLI integration
To update Jenkins:
sudo yum update jenkins -y
sudo systemctl restart jenkins
Contributions are welcome. Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
This project is under the MIT License - see the LICENSE file for details.
Andres Jose Sanchez - Initial Development - [andresjose84@gmail.com]