Skip to content

andresjose84/jenkins-cloudformation-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏗️ Jenkins Server Deployment on AWS EC2

Automated Jenkins server deployment on AWS EC2 using CloudFormation

🌟 Key Features

  • ⚡ Automated Jenkins installation
  • ☕ Java 17 pre-installed
  • 📀 Configurable EBS volume
  • 🔒 Available encryption options
  • 🛡️ Automatic security group creation
  • 🔧 AWS CLI integration

👌 Prerequisites

  • 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

📜 Base System Information

  • 🐧 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 System Information

  • 🐧 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

🔍 Compatibility Notes

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

⚙️ Main Parameters

Parameter Description Default Value
AWSRegion AWS Region for deployment us-east-1
JenkinsInstanceType EC2 instance type t2.micro
JenkinsVolumeSize EBS volume size (GB) 16

🚀 Deployment

  1. Clone the repository:
git clone <repository-URL>
  1. 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
  1. Connect to the EC2 Instance:
ssh -i "<name-key>.pem" ec2-user@<public-ip>.<region>.compute.amazonaws.com
  1. Get the Jenkins Admin Password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  1. Access Jenkins:
  • Wait approximately 5-10 minutes after deployment.
  • Access Jenkins using:
http://<public-ip>:8080

Note : In the output could find public DNS link

🔐 Security

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

🔧 Maintenance

Log Access

sudo tail -f /var/log/deploy.log

📄 Release Notes v1.0.0

  • Automated Jenkins installation
  • Support for Amazon Linux 2023
  • AWS CLI integration

🔄 Updates

To update Jenkins:

sudo yum update jenkins -y
sudo systemctl restart jenkins

🤝 Contributions

Contributions are welcome. Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

📝 License

This project is under the MIT License - see the LICENSE file for details.

✍️ Author

Andres Jose Sanchez - Initial Development - [andresjose84@gmail.com]

About

Deploy an ec2 Jenkins server from aws Cloudformation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published