Summary of Tasks:
Create a virtual machine on AWS
Setup docker and docker-compose on VM
Write a docker-compose file
Execute docker-compose file
Access your web server with VM public IP
Set-up Database
Watch my complete video of this project for troubleshooting
1. Create a virtual machine on AWS
Sign in to your AWS account and click on "Launch instance".
Choose Amazon Linux AMI or keep it default
In the instance type section, choose t2.micro and a key-pair
In the networking section, keep the default settings
In the storage and advance section, use default settings and click on the "Launch Instance" button on the right top corner
Your virtual machine is ready
2. Setup docker and docker-compose on VM
yum install docker -y
service docker start
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose;
- Write a docker-compose file
services:
wordpress:
container_name: wordpress_web
image: wordpress
ports:
- "80:80"
volumes:
- ./efs:/var/www/html
networks:
- web_cont_net
environment:
WORDPRESS_DB_HOST: mariadb
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: awais123
WORDPRESS_DB_NAME: cloud_db
mariadb:
container_name: wordpress_db
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: awais123
MYSQL_DATABASE: cloud_db
volumes:
- ./database:/var/lib/mysql
networks:
- web_cont_net
networks:
web_cont_net:
- Execute docker-compose file
docker-compose up -d
- Access your web server with VM public IP
you will see such an interface
6. Set-up Database
And your application is ready
7. Watch my complete video of this project for troubleshooting
If you face any issues, watch my complete video of this project on my channel
Top comments (0)