Day 47: AWS Elastic Beanstalk

Day 47: AWS Elastic Beanstalk

ยท

3 min read

What is AWS Elastic Beanstalk?

Elastic Beanstalk is a service for deploying and scaling web applications and services.

  • AWS Elastic Beanstalk is a service used to deploy and scale web applications developed by developers.

  • It supports multiple programming languages and runtime environments such as Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker.

Why do we need AWS Elastic Beanstalk?

  • Previously, developers faced challenges in sharing software modules across geographically separated teams.

  • AWS Elastic Beanstalk solves this problem by providing a service to easily share applications across different devices.

Advantages of AWS Elastic Beanstalk

  • Highly scalable

  • Fast and simple to begin

  • Quick deployment

  • Supports multi-tenant architecture

  • Simplifies operations

  • Cost efficient

Components of AWS Elastic Beanstalk

  • Application Version: Represents a specific iteration or release of an application's codebase.

  • Environment Tier: Defines the infrastructure resources allocated for an environment (e.g., web server environment, worker environment).

  • Environment: Represents a collection of AWS resources running an application version.

  • Configuration Template: Defines the settings for an environment, including instance types, scaling options, and more.

Elastic Beanstalk Environment

There are two types of environments: web server and worker.

  • Web server environments are front-end facing, accessed directly by clients using a URL.

  • Worker environments support backend applications or micro apps.

Task-01

Deploy the 2048-game using the AWS Elastic Beanstalk.

Prerequisites

Before you begin, make sure you have:

  • An AWS account with the necessary permissions.

  • Docker installed on your local machine.

  • A Dockerfile for your game setup.

Step 1: Login to the AWS Console

  1. Open your web browser and navigate to the AWS Management Console.

  2. Log in with your AWS account credentials.

Step 2: Search for the Elastic Beanstalk Service

  1. In the AWS Management Console, use the search bar at the top and type "Elastic Beanstalk."

  2. Click on the Elastic Beanstalk service in the search results.

Step 3: Create a New Application

  1. In the Elastic Beanstalk dashboard, click "Create Application."

Step 4: Select Web Server Environment

  1. Choose the type of environment that will host your application. Here, we select the web server environment.

Step 5: Name the Application

  1. Provide a name for your application.

Step 6: Name Environment and Add Description

  1. Assign a name to the environment and include a brief description.

  2. You can leave the domain name blank for an auto-generated value.

Step 7: Choose Docker Platform

  1. Select the Managed Platform and specify Docker as the platform type.

Step 8: Upload Docker File

  1. Opt for "Upload your code" and upload the Dockerfile you've created. Here's an example Dockerfile:
 FROM ubuntu:22.04

 RUN apt-get update
 RUN apt-get install -y nginx zip curl

 RUN echo "daemon off;" >>/etc/nginx/nginx.conf
 RUN curl -o /var/www/html/master.zip -L https://github.com/ArjunMnn/2048-game/archive/refs/heads/master.zip
 RUN cd /var/www/html/ && unzip master.zip && mv 2048-game-master/* . && rm -rf 2048-game-master master.zip

 EXPOSE 80

 CMD ["/usr/sbin/nginx", "-c", "/etc/nginx/nginx.conf"]

Step 9: Select Free Tier Eligible Option

  1. Choose the option that falls under the AWS Free Tier to ensure cost-effective deployment.

Step 10: Configure Service Access

Step 11: Review and Submit

  1. Review the settings and click "Create" to confirm the deployment.

Step 12: Initiate Environment Creation

  1. The process of creating the environment will begin. Wait for the deployment to complete.

Step 13: Load the Domain

  1. After successful environment creation, access your game using the provided domain.

I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .

thank you : )

ย