This project involves migrating a multi-tier web application stack (vProfile) from a local data center to the AWS cloud using a lift-and-shift strategy. The key AWS services used include EC2 instances, Elastic Load Balancer, Auto Scaling, S3, Route 53, IAM, ACM, and EBS.
- An AWS account
- Basic knowledge of AWS services
- AWS CLI installed and configured
- SSH client (e.g., Git Bash (used git bash and recommended) , or PuTTY for Windows or Terminal for macOS/Linux)
-
Launch EC2 Instances:
- Via AWS Console:
- Open the EC2 Management Console.
- Click
Launch Instance. - Choose an Amazon Machine Image (AMI).
- Select
t2.micro(free tier) as the instance type. - Configure instance details (number of instances, network settings).
- Add storage and tags.
- Configure a security group (e.g.,
vprofile app security group). - Review and launch the instance.
- Select or create a key pair (e.g.,
vprofile-prod-key). - Click
Launch.
- Via AWS Console:
-
Connect to EC2 Instance via SSH:
- Command:
ssh -i "vprofile-prod-key.pem" ec2-user@<instance-public-dns>
- Explanation:
ssh: Secure Shell command to connect to remote servers.-i "vprofile-prod-key.pem": Specifies the private key file for authentication.ec2-user@<instance-public-dns>: The default user and public DNS of the EC2 instance.
- Command:
-
Configure Instances:
- Update Package List:
sudo yum update -y
- Install Software (e.g., Tomcat, RabbitMQ, Memcached, MySQL):
sudo yum install -y tomcat rabbitmq-server memcached mysql-server
- Start and Enable Services:
sudo systemctl start tomcat sudo systemctl enable tomcat sudo systemctl start rabbitmq-server sudo systemctl enable rabbitmq-server sudo systemctl start memcached sudo systemctl enable memcached sudo systemctl start mysqld sudo systemctl enable mysqld
- Check Status of Services:
sudo systemctl status tomcat sudo systemctl status rabbitmq-server sudo systemctl status memcached sudo systemctl status mysqld
- Explanation:
sudo yum update -y: Updates all installed packages to the latest version.sudo yum install -y <package>: Installs specified packages.sudo systemctl start <service>: Starts the specified service.sudo systemctl enable <service>: Enables the service to start on boot.sudo systemctl status <service>: Checks the status of the service.
- Update Package List:
-
Verify Security Group Rules:
- Command:
aws ec2 describe-security-groups --group-ids <security-group-id>
- Explanation:
aws ec2 describe-security-groups: Describes the security group settings.--group-ids <security-group-id>: Specifies the security group ID.
- Command:
-
Create S3 Bucket and IAM User:
- Create S3 Bucket:
- Create IAM User:
- Command:
aws iam create-user --user-name <user-name> aws iam attach-user-policy --user-name <user-name> --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess
- Explanation:
aws iam create-user: Creates a new IAM user.aws iam attach-user-policy: Attaches a policy to the IAM user.
- Command:
-
Configure AWS CLI:
- Command:
aws configure
- Explanation:
- Prompts for AWS Access Key ID, Secret Access Key, default region name, and output format.
- Command:
-
Build Application Artifact:
- Command:
mvn clean package
- Explanation:
mvn clean package: Uses Maven to build the application artifact.
- Command:
-
Deploy Artifact to EC2:
- Upload Artifact:
aws s3 cp <artifact-file> s3://<bucket-name>/
- Download and Deploy on EC2:
aws s3 cp s3://<bucket-name>/<artifact-file> /path/to/deploy/ cd /path/to/deploy/ sudo tar -xzvf <artifact-file>
- Explanation:
aws s3 cp: Copies files to/from S3.tar -xzvf: Extracts a tarball file.
- Upload Artifact:
-
Create Application Load Balancer:
-
Configure Route 53:
- Create Private DNS Zone:
- Add CNAME Record:
- Via AWS Console:
- Navigate to the Hosted Zone.
- Click
Create Record Set. - Select
CNAMEand enter the load balancer endpoint.
- Via AWS Console:
-
Verify Load Balancer:
- Command:
curl -I https://<load-balancer-url>
- Explanation:
curl -I: Fetches HTTP headers to verify the response from the load balancer.
- Command:
-
Create AMI:
- Command:
aws ec2 create-image --instance-id <instance-id> --name "vprofile-app-image" --no-reboot
- Explanation:
aws ec2 create-image: Creates an AMI from the instance.--instance-id <instance-id>: Specifies the instance ID.--name "vprofile-app-image": Names the AMI.--no-reboot: Creates the AMI without rebooting the instance.
- Command:
-
Create Launch Template:
- Via AWS Console:
- Open the EC2 Management Console.
- Navigate to
Launch Templatesand clickCreate Launch Template. - Specify template details including AMI ID, instance type, security group, and IAM role.
- Via AWS Console:
-
Create Auto Scaling Group:
- Via AWS Console:
- Open the EC2 Management Console.
- Navigate to
Auto Scaling Groupsand clickCreate Auto Scaling Group. - Specify the name, launch template, VPC, and target group.
- Configure health checks, scaling policies, and notifications.
- Via AWS Console:
- Command:
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <auto-scaling-group-name>
- Explanation:
aws autoscaling describe-auto-scaling-groups: Describes the auto-scaling group settings.
-
Validate Setup:
- Access the application URL through the load balancer to ensure that the application is functional.
- Command:
curl -I https://<load-balancer-url>
- Explanation:
curl -I: Fetches HTTP headers to verify the response from the load balancer.
-
Summary:
- The application is accessible through an HTTPS load balancer.
- The load balancer forwards requests to Tomcat EC2 instances.
- EC2 instances are automatically scaled based on load.
- CI/CD Integration: Implement a CI/CD pipeline for automated artifact deployment.
- Managed Services: Consider migrating to AWS managed services like RDS for MySQL, ElastiCache for Memcached, and Amazon MQ for RabbitMQ.
.png)










