Welcome to CODEGRAM ( / codegram-tech ! In this video, we’ll Learn about how to create EC2 instance for deploying static website.
📌 *Topics Covered:*
1. Creating EC2 for deploying static site
2. Register EC2 instance in Code Deployment
3. EC2 Script to run
4. Adding appspec.yml, install_nginx.sh and start_nginx.sh files and push on code commit
5. Rebuilding the code
6. Do the deployment
⏰ *Timestamps:*
00:00 - Creating EC2 for deploying static site
04:58 - Register EC2 instance in Code Deployment
08:27 - EC2 Script to run
14:00 - Adding appspec.yml, install_nginx.sh and start_nginx.sh files and push on code commit
16:10 - Rebuilding the code
18:11 - Do the deployment
👍 *If you enjoyed this video, please:*
- Like the video
- Subscribe to the channel
- Hit the notification bell
🔗 *Related Links:*
- [#8: AWS code pipeline]( • #8: AWS code pipeline ... )
*** EC2 Script **
#!/bin/bash
This installs the CodeDeploy agent and its prerequisites on Ubuntu 22.04.
sudo apt-get update
sudo apt-get install ruby-full ruby-webrick wget -y
cd /tmp
wget aws-codedeploy-ap-south-1.s3....
mkdir codedeploy-agent_1.3.2-1902_ubuntu22
dpkg-deb -R codedeploy-agent_1.3.2-1902_all.deb codedeploy-agent_1.3.2-1902_ubuntu22
sed 's/Depends:.*/Depends:ruby3.0/' -i ./codedeploy-agent_1.3.2-1902_ubuntu22/DEBIAN/control
dpkg-deb -b codedeploy-agent_1.3.2-1902_ubuntu22/
sudo dpkg -i codedeploy-agent_1.3.2-1902_ubuntu22.deb
systemctl list-units --type=service | grep codedeploy
sudo service codedeploy-agent status
========================================================
*** appspec.yml code *******
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html
hooks:
AfterInstall:
- location: scripts/install_nginx.sh
timeout: 300
runas: root
ApplicationStart:
- location: scripts/start_nginx.sh
timeout: 300
runas: root
=========================================
** install_nginx.sh code ****
#!/bin/bash
sudo apt-get update
sudo apt-get install -y nginx
==========================================
*** start_nginx.sh code ****
#!/bin/bash
sudo service nginx start
==========================================
📱 *Connect with us:*
- Instagram: [@pankajcodegram]( / pankajcodegram )
💼 *Business Inquiries:* [pankajsimmc@gmail.com]
Thank you for watching! Make sure to leave your thoughts in the comments below.
Негізгі бет #7: Creating EC2 Instance for Deploying Static website | AWS Devops Course for beginners
Пікірлер