AWS Docker Deployment - Part 2

Configuring an AWS EC2 Instance for Deployment

In this notebook, we will configure the AWS EC2 instance for hosting applications, including installing necessary packages and setting up Docker.

Installing Required Software

Run the following commands to install Docker, Nginx, Git, and Certbot on the EC2 instance.


# Run these commands on your AWS EC2 instance
!sudo apt-get update && sudo apt-get install -y docker docker-compose nginx git
!sudo snap install certbot --classic
    

Configuring the Firewall

To allow SSH and web traffic, configure the firewall using UFW:


# Configure firewall settings
!sudo ufw allow OpenSSH
!sudo ufw allow 'Nginx Full'
!sudo ufw enable
    

Testing the Server

Once Nginx is installed, test if it is running correctly by executing:

!curl localhost

If the setup is successful, you should see an Nginx welcome page.