Deployment

Creating an AWS EC2 Instance:

  1. Navigate to the AWS Management Console and log in to your AWS account.
  2. Go to the EC2 Dashboard and click on the “Launch Instance” button.
  3. Choose an Amazon Machine Image (AMI) based on your requirements, such as Amazon Linux, Ubuntu, or any other supported OS.
  4. Select an instance type based on your application’s needs, considering factors like CPU, memory, and storage.
  5. Configure instance details, such as the number of instances, network settings, and IAM role if required.
  6. Add storage volumes as needed for your application’s data.
  7. Configure security groups to control inbound and outbound traffic to the instance.
  8. Review and launch the instance.

Understanding Docker:

Employed for hosting a Web Application. A Docker container sets up an environment housing the Web Application code along with all the necessary dependencies (like requirements.txt for Python). Docker stands as an open platform facilitating the development, transportation, and execution of applications.

Understanding CORS and its Importance:

CORS (Cross-Origin Resource Sharing) is a security mechanism that allows web servers to specify which origins (domains) are permitted to access the resources on a web page. It’s crucial for security because it prevents malicious websites from accessing sensitive data on other websites. Without CORS, browsers restrict cross-origin requests, meaning JavaScript on one domain cannot make requests to another domain.

CORS Configuration for Localhost and Deployment:

Localhost Support: During development, allow requests from localhost on the port your frontend runs (e.g., http://localhost:3000).

Deployment Verification: For production, update CORS to permit requests from the deployed domain(s) (e.g., https://example.com). Ensure secure settings and test thoroughly.

Popcorn Hack

Question 1: Which of the following is a security mechanism that allows web servers to specify which origins are permitted to access the resources on a web page?

A: “HTTPS” B: “SSL” C: “CORS” D: “DNS”

Purpose of DNS in Web Application Deployment:

DNS (Domain Name System) acts like a phonebook for the internet, translating domain names into IP addresses. In web application deployment, DNS plays a crucial role in directing users to the correct servers hosting the application. It allows users to access your web application by typing a human-readable domain name (e.g., example.com) instead of remembering complex IP addresses.

ex: Amazon Route 53

Nginx:

Nginx serves as a crucial component in the process of locating and directing requests to a web application hosted on a server. It acts as open-source software specializing in functions such as web serving, reverse proxying, caching, load balancing, media streaming, and other related tasks.

Popcorn Hack

Question 2: What is the purpose of DNS (Domain Name System) in web application deployment?

A: “To encrypt data transmitted between a user’s browser and the web server”,

B: “To specify which origins are permitted to access the resources on a web page”,

C: “To direct users to the correct servers hosting the application by translating domain names into IP addresses”,

D: “To manage and automate the provisioning of virtual servers on cloud platforms”

Importance of HTTPS and SSL Certificates:

HTTPS (Hypertext Transfer Protocol Secure) encrypts data transmitted between a user’s browser and the web server, ensuring privacy and security. SSL (Secure Sockets Layer) certificates authenticate the identity of websites and establish a secure connection. HTTPS and SSL certificates are essential for protecting sensitive information, such as login credentials, payment details, and personal data, from interception or tampering by malicious actors.

Installing Certbot on the EC2 Instance:

Certbot is a free, open-source software tool used for automating the process of obtaining and renewing SSL/TLS certificates.

sudo apt update
sudo apt install certbot python3-certbot-nginx

Issuing and Configuring SSL Certificates with Certbot:

Run Certbot and specify the –nginx option to automatically configure SSL for Nginx:

sudo certbot --nginx