<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Cansu Tekin</title>
    <description>The latest articles on DEV Community by Cansu Tekin (@cansu_tekin_b017634d64dfd).</description>
    <link>https://dev.to/cansu_tekin_b017634d64dfd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1517911%2F5841c6f5-aa77-458f-9411-2f6c03e10b16.jpeg</url>
      <title>DEV Community: Cansu Tekin</title>
      <link>https://dev.to/cansu_tekin_b017634d64dfd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cansu_tekin_b017634d64dfd"/>
    <language>en</language>
    <item>
      <title>Building a Scalable Web App with AWS Elastic Beanstalk, DynamoDB, CloudFront, and Edge Location - with AWS Dashboard and EB CLI</title>
      <dc:creator>Cansu Tekin</dc:creator>
      <pubDate>Tue, 02 Jul 2024 18:04:30 +0000</pubDate>
      <link>https://dev.to/cansu_tekin_b017634d64dfd/building-a-scalable-web-app-with-aws-elastic-beanstalk-dynamodb-cloudfront-and-edge-location-with-aws-dashboard-and-eb-cli-1j43</link>
      <guid>https://dev.to/cansu_tekin_b017634d64dfd/building-a-scalable-web-app-with-aws-elastic-beanstalk-dynamodb-cloudfront-and-edge-location-with-aws-dashboard-and-eb-cli-1j43</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F1%2AmxCDCTUxKMbrrEJtvDT4xA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F1%2AmxCDCTUxKMbrrEJtvDT4xA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this real-world project, I was tasked with implementing an application capable of supporting a high volume of simultaneous users. This application was utilized during a large conference attended by over 10,000 people, both in-person and online, from around the globe. The event featured live broadcasts and the drawing of 10 vouchers for 3 Cloud certifications. At the peak moment, more than 10,000 audience members registered their emails to participate in the raffle.&lt;/p&gt;

&lt;p&gt;We used AWS, Elastic Beanstalk services to deploy the web application, DynamoDB to store emails, and CloudFront to cache static and dynamic files in an Edge Location close to the user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution Architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F1%2AmZU0mWyGPiZoGrobEqdphA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F1%2AmZU0mWyGPiZoGrobEqdphA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 1: Create a table in DynamoDB to store users’ email addresses and deploy the application using Elastic Beanstalk&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 2: Create a CloudFront distribution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Part 3: Perform Load testing&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1: Create a table in DynamoDB to store users’ email addresses and deploy the application using Elastic Beanstalk
&lt;/h2&gt;

&lt;p&gt;Create a table in DynamoDB to store users’ email addresses and deploy the application using Elastic Beanstalk, which will provision infrastructures such as EC2, Elastic Load Balancer, and Auto Scaling group.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create a table in DynamoDB to store users’ email addresses&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Amazon DynamoDB is a fully managed, high-performance, and highly scalable NoSQL database service designed to handle large-scale data loads and ensure low-latency responses.&lt;/p&gt;

&lt;p&gt;Search for DynamoDB in the AWS console and create a table “users”. Leave anything else as default.&lt;/p&gt;

&lt;p&gt;A partition key is a unique attribute in a DynamoDB table that determines the partition in which the data is stored. Each item in the table must have a unique value for the partition key.&lt;/p&gt;

&lt;p&gt;Table name: users&lt;/p&gt;

&lt;p&gt;Partition key: email, type String&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F1%2Am18oCx8wgqXRVgFDbx7zOQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F1%2Am18oCx8wgqXRVgFDbx7zOQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create an Elastic Beanstalk Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon Elastic Beanstalk is an easy-to-use service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.&lt;/p&gt;

&lt;p&gt;Many people will try accessing our application from a mobile or desktop to register. At this stage, the application needs to be robust and scalable to handle high traffic from many users. Elastic Beanstalk allows us to deploy and manage the web application in AWS Cloud without worrying about the infrastructure. It simplifies the process by provisioning and managing essential AWS resources like EC2 instances, Elastic Load Balancers, and Auto Scaling groups, ensuring the application remains responsive and available under varying loads. We will upload the application files, and Elastic Beanstalk will automatically manage capacity provisioning, load balancing, and scaling.&lt;/p&gt;

&lt;p&gt;Elastic Beanstalk will use the provided application files to deploy the application. It is important to organize the application folders in a way that Elastic Beanstalk can understand. Check the &lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/tutorials.html" rel="noopener noreferrer"&gt;Elastic Beanstalk documentation&lt;/a&gt; before uploading the application files. Each application requires its own folder structure. This project’s folders and files were designed specifically for the Python application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AueDTEsvN4amAyDyv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AueDTEsvN4amAyDyv.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;application.py&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask, render_template, flash, redirect, url_for, session, request, logging
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from wtforms.validators import InputRequired, Email
import boto3
import os
from urllib.parse import quote as url_quote

application = Flask(__name__)

#dynamodb = boto3.resource('dynamodb', endpoint_url="http://localhost:8000")
region = os.environ['AWS_REGION']
dynamodb = boto3.resource('dynamodb',region_name=region)

def put_user(email):
    table = dynamodb.Table('users')
    response = table.put_item(
       Item={
            'email': email
        }
    )
    return response

# Index
@application.route('/', methods=['GET', 'POST'])
def index():
    form = RegisterForm(request.form)
    if request.method == 'POST' and form.validate():
        user_resp = put_user(form.email.data)
        return render_template('obrigado.html')

    return render_template('index.html', form=form)

# Register Form Class
class RegisterForm(Form):
    email = StringField('Email', [InputRequired("Please enter your email.")])

if __name__ == '__main__':
    application.secret_key='secret123'
    application.run(debug=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;requirements.txt&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;boto3==1.21.8
botocore==1.24.8
Flask==2.0.3
passlib==1.7.2
WTForms==2.3.3
jsons==1.6.1
itsdangerous==2.1.0
Werkzeug==2.0.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Proper organization of the application files helps Elastic Beanstalk deploy the application automatically. Structure your project, zip, and store the zip file in a S3 bucket or locally. Elastic Beanstalk will use it to deploy the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Configure environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Search for Elastic Beanstalk in the AWS console and “&lt;strong&gt;Create Application”.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Application name: tcb-conference&lt;/p&gt;

&lt;p&gt;Platform (runtime environment): Python 3.8&lt;/p&gt;

&lt;p&gt;Application code: Upload the application file code&lt;/p&gt;

&lt;p&gt;Presets: High availability&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3560%2F0%2A96GsS-oAhPV3ObZQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3560%2F0%2A96GsS-oAhPV3ObZQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It launches an environment named tcb-conference-env with these &lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.CreateApp.html" rel="noopener noreferrer"&gt;AWS resources:&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An Amazon Elastic Compute Cloud (Amazon EC2): An Amazon EC2 virtual machine configured to run web apps on the platform you choose.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An Amazon EC2 security group: An Amazon EC2 security group configured to allow incoming traffic on port 80. This resource lets HTTP traffic from the load balancer to the EC2 instance running your web app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An Amazon Simple Storage Service (Amazon S3) bucket: A storage location for your source code, logs, and other artifacts that are created when you use Elastic Beanstalk.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Amazon CloudWatch alarms: Two CloudWatch alarms that monitor the load on the instances in your environment and are triggered if the load is too high or too low. When an alarm is triggered, your Auto Scaling group scales up or down in response.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An AWS CloudFormation stack: Elastic Beanstalk uses AWS CloudFormation to launch the resources in your environment and propagate configuration changes. The resources are defined in a template that you can view in the &lt;a href="https://console.aws.amazon.com/cloudformation" rel="noopener noreferrer"&gt;AWS CloudFormation console.&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A domain name (autogenerated in our case): A domain name that routes to your web app in the form &lt;a href="http://subdomain.region.elasticbeanstalk.com" rel="noopener noreferrer"&gt;subdomain.region.elasticbeanstalk.com&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2420%2F0%2AZpRAsH9Mt0A0o1OV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2420%2F0%2AZpRAsH9Mt0A0o1OV.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We do not need to specify the S3 bucket URL at this point. Once we move to the next step (from environment configuration to service access configuration) an S3 bucket will be automatically created without waiting to complete the EBS application creation process. We can use this bucket to store our application code or create a different one. I will use this one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4068%2F0%2AUZCWISQcmZ8_INQ5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4068%2F0%2AUZCWISQcmZ8_INQ5.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After designing the folder structure for the Python application based on AWS Elastic Beanstalk documentation, the application files will be uploaded to S3 bucked. That location is used to run the application. Go to S3 bucked and upload the application files.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2360%2F0%2ATnf2XE-rlmow_1aH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2360%2F0%2ATnf2XE-rlmow_1aH.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4760%2F0%2A-kIsORSNbmqGpmt1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4760%2F0%2A-kIsORSNbmqGpmt1.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Update your Public S3 URL with the bucket URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2432%2F0%2AjIjgVnWgSvxSkksy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2432%2F0%2AjIjgVnWgSvxSkksy.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, all public access to this bucket is allowed as default. I will keep it as it is but update it for later projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Configure service access&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need to set up the necessary permissions and roles that allow Elastic Beanstalk to interact with other AWS services securely.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Service Role&lt;/strong&gt;: Grants permissions to the Elastic Beanstalk service itself, allowing it to manage AWS resources on your behalf. This includes creating and managing EC2 instances, load balancers, and other resources necessary for running your application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;EC2 Instance Profile:&lt;/strong&gt; Grants permissions to the EC2 instances running our application. It allows the instances to interact with other AWS services (e.g., S3, DynamoDB) on your behalf.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3764%2F0%2A2BsRccBwAaC1WhQX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3764%2F0%2A2BsRccBwAaC1WhQX.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you click View permission details you will see recommended permission by AWS. We will add them to our IAM roles as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service role permission recommendations:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkEnhancedHealth&lt;/strong&gt; (this comes as default)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy&lt;/strong&gt; (we will attach it)&lt;strong&gt;:&lt;/strong&gt; This policy is for the AWS Elastic Beanstalk service role used to perform managed updates of Elastic Beanstalk environments. The policy grants broad permissions to create and manage resources across several AWS services including AutoScaling, EC2, ECS, Elastic Load Balancing, and CloudFormation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;EC2 instance profile recommendations:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkWebTier:&lt;/strong&gt; Provide the instances in your web server environment access to upload log files to Amazon S3.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkWorkerTier:&lt;/strong&gt; Provide the instances in your worker environment access to upload log files to Amazon S3, to use Amazon SQS to monitor your application’s job queue, to use Amazon DynamoDB to perform leader election, and to Amazon CloudWatch to publish metrics for health monitoring.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkMulticontainerDocker:&lt;/strong&gt; Provide the instances in your multicontainer Docker environment access to use the Amazon EC2 Container Service to manage container deployment tasks.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;First, we need to create an IAM role and attach it to the Elastic Beanstalk application. You can select &lt;em&gt;Create and use a new service role&lt;/em&gt; if you do not have an existing one, or you want AWS to create one for you. This will create an IAM role with necessary permissions but you may need to add additional permissions based on your application needs. I will create a new one for this project following the steps below:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Service Role&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go to IAM -&amp;gt; Roles -&amp;gt; Create role -&amp;gt; AWS service&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3868%2F0%2AD49yFluVQeXUkALl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3868%2F0%2AD49yFluVQeXUkALl.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we specify the Use case as Elastic Beanstalk it comes with some &lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts-roles-service.html" rel="noopener noreferrer"&gt;default policies.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4844%2F0%2AKA82knGXtaRW6eEJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4844%2F0%2AKA82knGXtaRW6eEJ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Named :elastic-beanstalk-service-role&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkEnhancedHealth:&lt;/strong&gt; AWS Elastic Beanstalk Service policy for Health Monitoring system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkService:&lt;/strong&gt; AWS Elastic Beanstalk Service role policy grants permissions to create &amp;amp; manage resources (i.e.: AutoScaling, EC2, S3, CloudFormation, ELB, etc.) on your behalf. This policy comes with the following permissions by default:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AllowCloudformationOperationsOnElasticBeanstalkStacks&lt;/strong&gt;: Allows full CloudFormation operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AllowDeleteCloudwatchLogGroups&lt;/strong&gt;: Allows Elastic Beanstalk to clean up log groups when environments are deleted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AllowECSTagResource&lt;/strong&gt;: Allows tagging of ECS resources&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AllowS3OperationsOnElasticBeanstalkBuckets&lt;/strong&gt;: Allows full S3 operations on Elastic Beanstalk-specific buckets. Grants permissions to manage Elastic Beanstalk application versions, environment configurations, and logs stored in S3 buckets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AllowLaunchTemplateRunInstances&lt;/strong&gt;: Enables Elastic Beanstalk to launch EC2 instances using predefined launch templates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AllowOperations&lt;/strong&gt;: Allows Elastic Beanstalk to fully manage instances, security groups, load balancers, scaling policies, and other resources necessary for the application environment. Includes permissions for Auto Scaling, EC2, ECS, Elastic Load Balancing, IAM, CloudWatch, RDS, S3, SNS, SQS, and CodeBuild.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3212%2F0%2ACyS6jIPiIeHRElS0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3212%2F0%2ACyS6jIPiIeHRElS0.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most of the necessary policies are attached by default. Create a role with given permissions first. If we need any additional permission we need to attach it to this role.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4144%2F0%2AhTH4zxaVrGzx56pb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4144%2F0%2AhTH4zxaVrGzx56pb.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will attach the recommended policy we mentioned earlier: &lt;strong&gt;AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4024%2F0%2ARTZUH7S8yg322eOb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4024%2F0%2ARTZUH7S8yg322eOb.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy&lt;/strong&gt;: Includes permissions needed specifically for updating instances and other resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWSElasticBeanstalkService&lt;/strong&gt;: Includes a wider range of permissions necessary for creating, updating, and deleting various AWS resources managed by Elastic Beanstalk. This policy is on a deprecation path. It comes as a default for now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Create an EC2 Instance Profile&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will follow similar steps to create an EC2 Instance Profile.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4860%2F0%2AUB8xwU2ypDipUesW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4860%2F0%2AUB8xwU2ypDipUesW.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to attach specific policies to give additional permission to the EC2 instance that our Python application will run inside it. In our case, our application needs to write data and read data from the DynamoDB table. We need a specific policy for that which is &lt;em&gt;AmazonDynamoDBFullAccess.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4748%2F0%2Ax9WDQKxXxy5-YiR8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4748%2F0%2Ax9WDQKxXxy5-YiR8.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Named :elastic-beanstalk-ec2-service-role&lt;/p&gt;

&lt;p&gt;After we added AWS recommended policies, the final role comes with the following policies:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3948%2F0%2ANnBfal262_rPWtq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3948%2F0%2ANnBfal262_rPWtq3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Create an SSH key:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To access the EC2 instance via SSH connection we will create an SSH key.&lt;/p&gt;

&lt;p&gt;EC2 -&amp;gt; Key pairs -&amp;gt; Create key pair&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2784%2F0%2ANZoKx_YJUwSDH-Ek.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2784%2F0%2ANZoKx_YJUwSDH-Ek.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Download and store the key.&lt;/p&gt;

&lt;p&gt;We are all set for service access configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3672%2F0%2A7SkNKbEIWYiHGP62.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3672%2F0%2A7SkNKbEIWYiHGP62.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can &lt;em&gt;Skip to review&lt;/em&gt; and edit configuration there or you can go step by step until the end.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Set up networking, database, and tags-&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.vpc.html" rel="noopener noreferrer"&gt;optional&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you don’t configure a VPC, Elastic Beanstalk uses the default VPC. I will use a custom VPC I had before. You can use the default one. The configuration will be the same.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4264%2F0%2AFaLnOX3T1NmaICm2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4264%2F0%2AFaLnOX3T1NmaICm2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will choose subnets in each AZ for the EC2 instances that run our application. To avoid exposing our application instances to the Internet, we can run them inside private subnets and load balancers in public subnets such that our application will be open the public access through NAT. If we choose private subnets for our EC2 instances, the VPC must have a NAT gateway in a public subnet that the EC2 instances can use to access the Internet. I will not create a NAT gateway and I will run both in public subnets for simplicity. To run the load balancer and instances in the same public subnets, we will assign public IP addresses to the instances.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2988%2F0%2ANmiEGuP9aLyGC6ni.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2988%2F0%2ANmiEGuP9aLyGC6ni.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I only picked public subnets and activated public IP addresses for EC2 instances. I am not going to use RDS, I will move to the next configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Configure instance traffic and scaling *— optional&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;We will set the Root volume type: General Purpose SSD — 8 GB&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3476%2F0%2Aej7MY95wQeuteBTi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3476%2F0%2Aej7MY95wQeuteBTi.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Capacity:&lt;/em&gt;&lt;/strong&gt;Instances Min: 2 Instances Max: 4 Instance type: t2-micro&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2416%2F0%2AepIeRMMSJkTZppzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2416%2F0%2AepIeRMMSJkTZppzj.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Elastic Beanstalk will automatically create a Load Balancer for our application, with a minimum of 2 EC2 instances running when we first launch our application, and a maximum of 4 if triggered.&lt;/p&gt;

&lt;p&gt;Configure the trigger that lets the auto-scaling group know when to scale up and add up more instances. if the load goes beyond 50% of CPU utilization, it is going to add more instances up to 4 to keep up with the workload.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Scaling triggers:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2144%2F0%2AJlPzlEqa2pmrtaAv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2144%2F0%2AJlPzlEqa2pmrtaAv.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Load balancer network settings:&lt;/em&gt;&lt;/strong&gt; We will use the same setting as we used for EC2 instances.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2152%2F0%2AxqeqKUd7cvYbEcqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2152%2F0%2AxqeqKUd7cvYbEcqv.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Listeners:&lt;/em&gt;&lt;/strong&gt; By default, the load balancer is configured with a standard web server on port 80. I will use default settings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2120%2F0%2AUNOgUFfdyomVygEh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2120%2F0%2AUNOgUFfdyomVygEh.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you wish you can configure Elastic Load Balancer to capture logs with detailed information about requests sent to your Load Balancer. Those logs will be stored in Amazon S3. I will not enable it for this project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2208%2F0%2AWM5NNU8i6Riq-4UL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2208%2F0%2AWM5NNU8i6Riq-4UL.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Configure updates, monitoring, and logging *— optional&lt;/strong&gt;*&lt;/p&gt;

&lt;p&gt;I will not touch settings here, if you want you can configure them based on your needs. It uses NGINX by default.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3284%2F0%2AT_sfDDK_mWoadTz3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3284%2F0%2AT_sfDDK_mWoadTz3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3420%2F0%2AzkHw224dQCIlDHte.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3420%2F0%2AzkHw224dQCIlDHte.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will only set the AWS_REGION environment variable here. It will be passed to my application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2156%2F0%2AZ6ZCv3V72Zf7MSKV.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2156%2F0%2AZ6ZCv3V72Zf7MSKV.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Submit to create the environment for the application run. It takes a few minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4216%2F0%2AaVGmlF_bHDJsMkNH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4216%2F0%2AaVGmlF_bHDJsMkNH.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;S3 Bucket:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4180%2F0%2A3UNJKn5OF338Ubtd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4180%2F0%2A3UNJKn5OF338Ubtd.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;EC2 instances:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4492%2F0%2AlLsjUMX8urMeuMEr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4492%2F0%2AlLsjUMX8urMeuMEr.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Security Groups:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4392%2F0%2A93NeAFTWzznpvslR.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4392%2F0%2A93NeAFTWzznpvslR.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Inbound-outbound rules of security groups:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4228%2F0%2AoBduRmnK9sniLG4F.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4228%2F0%2AoBduRmnK9sniLG4F.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4192%2F0%2Ag7D-XmRzWwuXzg76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4192%2F0%2Ag7D-XmRzWwuXzg76.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4212%2F0%2AzuLxFJU7MVlZgYNc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4212%2F0%2AzuLxFJU7MVlZgYNc.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Load Balancer:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4260%2F0%2Av0OdhrXZD-0hGfmH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4260%2F0%2Av0OdhrXZD-0hGfmH.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The environment health turned to RED, I will look at the logs and figure it out before trying to run my application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4976%2F0%2AbNetjzXXCUADK9bQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4976%2F0%2AbNetjzXXCUADK9bQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It did not work in my case. I ran this application without any problem with the same settings before. It should work. I do not know if AWS has updated any settings on its services since my last run. I got the following error for this time:&lt;/p&gt;

&lt;p&gt;ERROR: ModuleNotFoundError: No module named 'application'&lt;/p&gt;

&lt;p&gt;I applied the solutions below to solve it but I was not able to solve this error after too much debugging.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS calls the Flask instance as an &lt;em&gt;application&lt;/em&gt; but Gunicorn calls it as an &lt;em&gt;app.&lt;/em&gt; I updated a line, application = app = Flask(&lt;strong&gt;name&lt;/strong&gt;), in my &lt;em&gt;application.py&lt;/em&gt; file and then set WSGIPath to application:application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will use EB CLI after this point with the exact same settings. If you are also not able to run or debug by yourself you can move with me to use EB CLI.&lt;/p&gt;

&lt;p&gt;Do not forget to destroy all the resources you created with Elastic Bean Stalk; &lt;em&gt;tcb-conference-env&lt;/em&gt; and &lt;em&gt;tcb-conference&lt;/em&gt; application. Keep the DynamoDB table.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building a Scalable Web App with AWS Elastic Beanstalk, DynamoDB, and CloudFront — with EB CLI
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Part 1: Deploy the application using Elastic Beanstalk — with EB CLI
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Install EB CLI&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;EB CLI is AWS Elastic Beanstalk Command Line Interface. First, we will install EB CLI. You can use this &lt;a href="https://github.com/aws/aws-elastic-beanstalk-cli-setup?tab=readme-ov-file#macoslinux" rel="noopener noreferrer"&gt;aws-elastic-beanstalk-cli-setup&lt;/a&gt; to install based on your operating system. I will follow the instructions for MacOS:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install awsebcli
# Verify the EB CLI Installation
eb --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;2. Configure the EB CLI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Initialize an EB CLI project and select your region.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Initialize 
eb init

#or
eb init -p python-3.8 tcb-conference --region us-east-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3860%2F0%2Azrvpz6hHlkO01h94.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3860%2F0%2Azrvpz6hHlkO01h94.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Setup IAM Credentials&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We must provide our credentials first. We must provide a secret key and access key to authenticate (who we are) and authorize (what permission we do have) to allow EB CLI to access and manage AWS resources for us. Let’s go to the IAM console to create a secret and access key. The secret access key is available for download only when you create it, make sure you download it after you create it.&lt;/p&gt;

&lt;p&gt;Go to IAM console -&amp;gt; Users -&amp;gt; Create User&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4796%2F0%2ABXiCWRl2zE8b6Ink.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4796%2F0%2ABXiCWRl2zE8b6Ink.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will give AdministratorAccess access, and I can update later if I wish.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4860%2F0%2Ar7BK4I90wZkUps54.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4860%2F0%2Ar7BK4I90wZkUps54.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go and create access key.&lt;/p&gt;

&lt;p&gt;Use case: Command Line Interface (CLI)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4048%2F0%2AGFKBB82fJuDcJmS_.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4048%2F0%2AGFKBB82fJuDcJmS_.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you run EB CLI it will ask for these credentials. You can also configure the AWS CLI using environment variables&lt;/p&gt;

&lt;p&gt;export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY_ID&lt;/p&gt;

&lt;p&gt;export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY&lt;/p&gt;

&lt;p&gt;export AWS_DEFAULT_REGION=us-east-1&lt;/p&gt;

&lt;p&gt;We are ready to configure the EBS environment, similar to what we did on the AWS console before:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3748%2F0%2AkQ1v61MO_bg0mIv7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3748%2F0%2AkQ1v61MO_bg0mIv7.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Create an Elastic Beanstalk Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will use the YAML file for configuration. The YAML file should be under &lt;em&gt;.ebextentions&lt;/em&gt;. EBS will automatically detect and run this config file when it is provided. Otherwise, it will use default EBS settings to create an EBS environment.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir .ebextensions 
touch .ebextensions/environment_configuration.config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ad0lxPV_wvcHKU2wn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2Ad0lxPV_wvcHKU2wn.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2124%2F0%2ADcGAxQ9wS9O-x73N.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2124%2F0%2ADcGAxQ9wS9O-x73N.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our application files will be zipped and uploaded to the S3 bucket while creating the environment.&lt;/p&gt;

&lt;p&gt;We will use the same configuration in our YAML file. This is actually easier and faster compared to using AWS Dashboard.&lt;/p&gt;

&lt;p&gt;YAML config file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;option_settings:
  aws:elasticbeanstalk:environment:
    ServiceRole: "aws-elasticbeanstalk-service-role" # Set service role
  aws:autoscaling:launchconfiguration:
    InstanceType: t2.micro # Specify the instance type (adjust as needed)
    EC2KeyName: ebs-ssh-key # Set EC2 key pair
    IamInstanceProfile: aws-elasticbeanstalk-ec2-role # Set IAM instance profile
    RootVolumeType: gp2
    RootVolumeSize: "10"
    DisableIMDSv1: true # Deactivate IMDSv1
  aws:autoscaling:asg:
    MaxSize: 4 # Maximum number of instances
    MinSize: 2 # Minimum number of instances
  aws:ec2:vpc:
    VPCId: "vpc-03f8678fb9c5d5ea1" # Set the VPC ID
    ELBScheme: public
    Subnets:
      - "subnet-0449c3e40202e7665"
      - "subnet-01e26ba1a707f5b13"
      - "subnet-06a672c7f4aea1795"
      - "subnet-0461ac2c4cea08257"
    ELBSubnets:
      - "subnet-0449c3e40202e7665"
      - "subnet-01e26ba1a707f5b13"
      - "subnet-06a672c7f4aea1795"
      - "subnet-0461ac2c4cea08257"
    AssociatePublicIpAddress: true # Enable public IP addresses for instances
  aws:elasticbeanstalk:healthreporting:system:
    SystemType: "basic" # Enable enhanced health reporting
  aws:autoscaling:trigger:
    MeasureName: "CPUUtilization" # Use CPUUtilization as trigger measurement
    UpperThreshold: "50" # Upper threshold for CPU utilization
    LowerThreshold: "40" # Lower threshold for CPU utilization
    Unit: "Percent"
    Period: "1"
    UpperBreachScaleIncrement: "1" # Increase instance count by 1 on upper breach
    LowerBreachScaleIncrement: "-1" # Decrease instance count by 1 on lower breach
  aws:elasticbeanstalk:container:python:
    WSGIPath: "application:application" # Set WSGIPath to application:application
  aws:elasticbeanstalk:application:environment:
    AWS_REGION: "us-east-1" # Set AWS_REGION environment property
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can use &lt;a href="https://docs.aws.amazon.com/pdfs/elasticbeanstalk/latest/dg/awseb-dg.pdf#command-options-general" rel="noopener noreferrer"&gt;EBS documentation&lt;/a&gt; here while preparing your YAML file.&lt;/p&gt;

&lt;p&gt;Ready to create an EBS environment:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eb create tcb-conference-env --region us-east-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5120%2F0%2A94y87p7tVydQJIje.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5120%2F0%2A94y87p7tVydQJIje.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are now able to create our EBS environment without any problems at this time!&lt;/p&gt;

&lt;p&gt;Health: OK&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4064%2F0%2AE7xiJD3XBFv8zTVX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4064%2F0%2AE7xiJD3XBFv8zTVX.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the Domain name to open the application:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3152%2F0%2A7vFetVgxw8n0jSBx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3152%2F0%2A7vFetVgxw8n0jSBx.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our application files were zipped and uploaded to the S3 bucket. Remember we created an EBS application named &lt;em&gt;tcb-conference&lt;/em&gt; at the beginning of the EB CLI initialization. Our files are zipped and placed in a directory named &lt;em&gt;tcb-conference.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;S3 bucket:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4772%2F0%2AY0D9LQKIRHt-_uHA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4772%2F0%2AY0D9LQKIRHt-_uHA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;EC2 instances (Minimum 2):&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4984%2F0%2AwDTna15NaXLAhvZg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4984%2F0%2AwDTna15NaXLAhvZg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Load Balancer:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4200%2F0%2Aq39EjotpNEbqMeDZ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4200%2F0%2Aq39EjotpNEbqMeDZ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Auto Scaling Group:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4152%2F0%2AhMr5HG3M2LSzmpBt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4152%2F0%2AhMr5HG3M2LSzmpBt.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;CloudFormation:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4208%2F0%2AkKDl8vXIpJWrsbjF.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4208%2F0%2AkKDl8vXIpJWrsbjF.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Validate the Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The participants will need to enter their email address on the web page and the application will insert the email address into the DynamoDB.&lt;/p&gt;

&lt;p&gt;Try to register:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3124%2F0%2AHGcSlJDKqwLiprhw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3124%2F0%2AHGcSlJDKqwLiprhw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3980%2F0%2AhQgrgC6zXI3QZUcH.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3980%2F0%2AhQgrgC6zXI3QZUcH.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Upps! We are not able to register. Our frontend is working but we are not allowed to register. Our email will not be written to DynamoDB. Let’s go and check our EC2 instance role.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4076%2F0%2AiOiRVgrBVg25fa8b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4076%2F0%2AiOiRVgrBVg25fa8b.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We do not have permission to write data to DynamoDB. Permit your EC2 instance to write data on the DynamoDB table inside the IAM role. Add the permission &lt;strong&gt;AmazonDynamoDBFullAccess&lt;/strong&gt; on the EC2 associate role in IAM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4688%2F0%2ARC57tC5R5LOaLZzY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4688%2F0%2ARC57tC5R5LOaLZzY.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try again:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3472%2F0%2Ajao8Tew-7DSApR1U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3472%2F0%2Ajao8Tew-7DSApR1U.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Check the &lt;em&gt;users’&lt;/em&gt; DynamoDB table:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4116%2F0%2A-G-LtBLNTxzbe6sp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4116%2F0%2A-G-LtBLNTxzbe6sp.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Awesome!&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 2: Create a CloudFront Distribution
&lt;/h2&gt;

&lt;p&gt;The CloudFront is a Content Delivery Network. All the static and dynamic files (CSS, HTML, etc) coming from the application will be cached on the edge location closer to the user so that it can improve the application’s performance and provide the lowest latency. When a user requests content, the request is routed to the edge location.&lt;/p&gt;

&lt;p&gt;Go to Console and search for CloudFront -&amp;gt; Create a CloudFront distribution&lt;/p&gt;

&lt;p&gt;Our application origin is our Elastic Load Balancer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2500%2F0%2A4gyrTMqPu9yMHJAG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2500%2F0%2A4gyrTMqPu9yMHJAG.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2420%2F0%2AbFX-3MEFat36Rd5s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2420%2F0%2AbFX-3MEFat36Rd5s.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Cache policy: CachingOptimized&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allowed HTTP methods: GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE. We want to allow the POST method to insert the data inside DynamoDB.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2416%2F0%2ASBOmJYfNEPNRUrhJ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2416%2F0%2ASBOmJYfNEPNRUrhJ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2424%2F0%2AJ3Ka-vowkuYolYNG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2424%2F0%2AJ3Ka-vowkuYolYNG.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2420%2F0%2A2cn2fPRLc66idoF2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2420%2F0%2A2cn2fPRLc66idoF2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Once CloudFront distribution is created, a domain name to access our application is already associated with it. This will give the Route 53 DNS entry that we use to access the application throughout CloudFront.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We could have a Custom SSL certificate — (optional), branded and customized domain name for our purpose associated with our CloudFront distribution and put the SSL certificate associated with that as well. We are going to use the default one created for us.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4800%2F0%2A_oCEduCKnmyC0nGX.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4800%2F0%2A_oCEduCKnmyC0nGX.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy the CloudFront domain name when it is ready. Let’s confirm if we can access the application using the CloudFront.&lt;/p&gt;

&lt;p&gt;Here it is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3504%2F0%2AASJgTA7a-UIv7j8O.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3504%2F0%2AASJgTA7a-UIv7j8O.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3: Perform Load testing
&lt;/h2&gt;

&lt;p&gt;We will basically simulate here what will happen if many users are accessing to EC2 instance at the same time and CPU utilization goes up.&lt;/p&gt;

&lt;p&gt;We will induce load on the CPU. Copy the IP address from one of the EC2 instances. Open remote connectivity on your computer via SSH:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2588%2F0%2A9SERuGyLfqoTK4WW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2588%2F0%2A9SERuGyLfqoTK4WW.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ssh -i "ebs-ssh-key.pem" ec2-user@&lt;a href="http://ec2-52-201-156-146.compute-1.amazonaws.com" rel="noopener noreferrer"&gt;ec2-52-201-156-146.compute-1.amazonaws.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4184%2F0%2AMHY1wz-AzqD4093u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4184%2F0%2AMHY1wz-AzqD4093u.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Install the stress tool to perform the load testing:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo amazon-linux-extras install epel -y
sudo yum install stress -y
stress -c 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This comment is going to bump up the CPU utilization inside the EC2 instance. Check Elastic Beanstalk status if it is turned “Warning”. Stress command bumping CPU utilization of this instance 100 %. We configured it as if CPU utilization is higher than 50%, the auto-scaling group will add one new instance so we can keep up with the workload.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4124%2F0%2A8W4sCLRyBdF68PNn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4124%2F0%2A8W4sCLRyBdF68PNn.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open a new terminal, connect remotely with SSH again, and use the “top” command that shows CPU utilization on the operating system.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3496%2F0%2ADklh_WwBdjhHg9mB.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3496%2F0%2ADklh_WwBdjhHg9mB.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;New instances will be added shortly to scale up. Every single user who goes through the load balancer will be redirected to one of these instances.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3764%2F0%2AaqenaqbHLB6-0eZt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3764%2F0%2AaqenaqbHLB6-0eZt.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4396%2F0%2A8bwQqhKPtqRa877R.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4396%2F0%2A8bwQqhKPtqRa877R.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Stop the loading process and end up stress command and check the process is not running anymore by running the command below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ctrl + C
ps -ef | grep stress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The stress is running anymore so the health status will change to OK. The auto scale will scale down and remove 3rd instance added before, so we can save cost.&lt;/p&gt;

&lt;p&gt;Once you finish exploring it, please remove the Elastic Beanstalk application, and Elastic Beanstalk environment, disable and delete the CloudFront distribution, and finally delete the DynamoDB users table.&lt;/p&gt;

&lt;p&gt;CONGRATULATIONS!!!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;REFERENCES&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts-roles-service.html" rel="noopener noreferrer"&gt;Elastic Beanstalk service role&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html" rel="noopener noreferrer"&gt;AWS Elastic Beanstalk Developer Guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html" rel="noopener noreferrer"&gt;AWS-Deploying a Flask application to Elastic Beanstal&lt;/a&gt;k&lt;/p&gt;

&lt;p&gt;&lt;a href="https://testdriven.io/blog/flask-elastic-beanstalk/" rel="noopener noreferrer"&gt;Deploying a Flask Application to Elastic Beanstalk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.python" rel="noopener noreferrer"&gt;Elastic Beanstalk-supported platforms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/62479386/no-module-named-application-error-while-deploying-simple-web-app-to-elastic-be" rel="noopener noreferrer"&gt;No module named ‘application’ Error while deploying a simple web app to Elastic Beanstalk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://repost.aws/questions/QUcm3GAgnESN2wCOtD-hqzsQ/wsgi-configuration-for-django-deployment-using-eb-cli" rel="noopener noreferrer"&gt;WSGI configuration for Django Deployment using EB CLI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-sourcebundle.html" rel="noopener noreferrer"&gt;Create an application source bundle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/Welcome.html" rel="noopener noreferrer"&gt;What is AWS Elastic Beanstalk?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.html" rel="noopener noreferrer"&gt;Deploy a sample web application using Elastic Beanstalk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html" rel="noopener noreferrer"&gt;Install the EB CLI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html" rel="noopener noreferrer"&gt;AWS security credentials&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/pdfs/elasticbeanstalk/latest/dg/awseb-dg.pdf#command-options-general" rel="noopener noreferrer"&gt;EBS configuration options for all environments&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ebcli</category>
      <category>aws</category>
      <category>elasticbeanstalk</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Migration of a Workload running in a Corporate Data Center to AWS using the Amazon EC2 and RDS service</title>
      <dc:creator>Cansu Tekin</dc:creator>
      <pubDate>Fri, 24 May 2024 02:10:44 +0000</pubDate>
      <link>https://dev.to/cansu_tekin_b017634d64dfd/migration-of-a-workload-running-in-a-corporate-data-center-to-aws-using-the-amazon-ec2-and-rds-service-5e6h</link>
      <guid>https://dev.to/cansu_tekin_b017634d64dfd/migration-of-a-workload-running-in-a-corporate-data-center-to-aws-using-the-amazon-ec2-and-rds-service-5e6h</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AfdXk-sdxbc_48Hbf-fydgg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AfdXk-sdxbc_48Hbf-fydgg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In another project based on a real-world scenario, I acted as the Cloud Specialist responsible for migrating a workload running in a Corporate Data Center to AWS.&lt;br&gt;
 The application and database were migrated to AWS using the Lift &amp;amp; Shift (rehost) model, moving both application and database data.&lt;/p&gt;

&lt;p&gt;Migration steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Planning: sizing, prerequisites, resource naming&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implementation: resource provisioning, best practices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go-live: validation test — Dry-run, final migration — Cutover&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Post Go-live: ensuring the operation of the application and user access&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AIUtZKDJGH636FtnjEUaSlg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2AIUtZKDJGH636FtnjEUaSlg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Planning&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The client provided information and files for the application and the database to migrate from the on-premise environment to the AWS cloud.&lt;/p&gt;

&lt;p&gt;Python Web — Wiki Server Application: Prerequisite python packages and libraries for the application to be run successfully on the AWS EC2 application server are determined.&lt;/p&gt;

&lt;p&gt;MySQL 5.7 Python Web — Wiki DB Server: Size, host/server name, IP address, CPU, and necessary description are provided to migrate it to the Amazon RDB server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4724%2F1%2A30uTpS4HG0l9X1fpP5jPfw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4724%2F1%2A30uTpS4HG0l9X1fpP5jPfw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Implementation&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Create a VPC (Amazon Virtual Private Cloud): The purpose is to build a virtual and isolated network. The accessibility of the Amazon RDB and EC2 instance resources on the Internet will be controlled by the assignment of IP addresses. One public subset and two private subsets were added to VCP. The IPv4 CIDR block must not overlap with any existing CIDR block that’s associated with the VPC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2560%2F1%2Axt0IEANkdBP-bJ41h0xdaA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2560%2F1%2Axt0IEANkdBP-bJ41h0xdaA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2556%2F1%2A0q04_IJyG2KCpiixCvowWA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2556%2F1%2A0q04_IJyG2KCpiixCvowWA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2576%2F1%2AltImZXnFiILlacdk6EGAfw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2576%2F1%2AltImZXnFiILlacdk6EGAfw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an Internet Gateway and attach it to a VPC: Necessary for the connection between EC2 and the Internet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2676%2F1%2AZfDWOQtmVzOljZGW7m8cfw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2676%2F1%2AZfDWOQtmVzOljZGW7m8cfw.png" alt="Internet Gateway"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2792%2F1%2A0sqnEhlKfZ-f7ImqSP3a1A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2792%2F1%2A0sqnEhlKfZ-f7ImqSP3a1A.png" alt="Attach Internet Gateway to VPC"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Route Table: There is already an attached route table to VPC when it is created but it is local and only routing internal traffics. We want to add new traffics to allow users coming from the Internet to access the EC2 application instance. The EC2 instance also can initiate internet connections from itself like connection to download packages etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5004%2F1%2AkK5PGJoWeT8_etbI-5xwmw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5004%2F1%2AkK5PGJoWeT8_etbI-5xwmw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create an EC2 instance with a new Security Group and Key Pair (&lt;em&gt;.pem)&lt;/em&gt;: EC2 instance(AMI: Ubuntu 18.04) within the previously launched VPC network was created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Key pair was created while creating the EC2 instance and downloaded to the desktop. It is necessary to connect remotely to the EC2 instance from the desktop via ssh.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security Group was created and configured to open a port so that we can access the services running on the virtual machine. A new security rule was added for the application to be accessed over the internet only port 8080.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4240%2F1%2AIzrMUyczq4wHqt7njEy4Xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4240%2F1%2AIzrMUyczq4wHqt7njEy4Xw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create MySQL RDS instance: It should be the same version from the on-promises environment or a newer version but we need to make sure this change will not affect anything else. Public access: No, never set it to “yes” if it is not really necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4148%2F1%2A_HYERT4qVSdRLDbPUMZ5vg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4148%2F1%2A_HYERT4qVSdRLDbPUMZ5vg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Pre-requisites steps: It should be connected to the EC2 instance using ssh and pair-key which was downloaded before in “.pem” format. It is important to prepare the EC2 instance to make the application work properly on it. Required python packages and libraries were installed as determined in the planning step.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set the permissions of your private key so that only you can read it. chmod 400 key-pair-name.pem&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4440%2F1%2Ae5bmsP0yXeGR-RIHZ53qXg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4440%2F1%2Ae5bmsP0yXeGR-RIHZ53qXg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On-Live&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is broken into two steps, the validation (dry run) and the cutover.&lt;/p&gt;

&lt;p&gt;Validation(dry-run):&lt;/p&gt;

&lt;p&gt;The on-premises resources should be up and running at this stage. Once the validation is completed successfully, a downtime window can be scheduled when the business is not running and run the final migration switching from the on-premise environment to the cloud (cutover).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;1) Database and 2) application deployment resources from the on-premises environment were exported and 3) put in an AWS S3 bucket. Then we can transfer files from the S3 bucket to related subnets in VCP. It is connected to the EC2 instance and opened remote connectivity from the local computer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;4) The application deployment files were imported to the EC2 instance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$ ssh ubuntu@ -i &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3228%2F1%2A5DQp728RQTZIlwkRhQaveA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3228%2F1%2A5DQp728RQTZIlwkRhQaveA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5) Remotely Connected to MySQL running on AWS RDS so that we can import the data coming from the on-premise DB. DB files were imported to the AWS RDB. 6) The connectivity between the EC2 instance and RDB was established in the application configuration file by pointing to the AWS RDB hostname.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5120%2F1%2ASAVLWNRHDRRIpOLqK4zoLg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5120%2F1%2ASAVLWNRHDRRIpOLqK4zoLg.png" alt="Create a Database named wikidb in MySQL running on AWS RDS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new user wiki in the wikidb was created so that application can go ahead and connect to the database, it will do connectivity from the application to the database.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2520%2F1%2AvW8Ha98ISi3MSYP2BZiaow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2520%2F1%2AvW8Ha98ISi3MSYP2BZiaow.png" alt="Create a new user in the wikidb"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unzip the app files, it is configuration files from the application that we want to point to MySQL DB running on AWS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3228%2F1%2A5DQp728RQTZIlwkRhQaveA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3228%2F1%2A5DQp728RQTZIlwkRhQaveA.png" alt="Application configuration to point to MySQL DB running on AWS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch the application to validate the migration: Bring up the application to see if the application will be connected to the RDS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;:8080&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5084%2F1%2AqX8TqeoT8FO5Wl7tba46jA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5084%2F1%2AqX8TqeoT8FO5Wl7tba46jA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new article was created to see if the application is able to not only read from MySQL database but also write on it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4688%2F1%2AVvJCv-qMXHGs82K9buIjEw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F4688%2F1%2AVvJCv-qMXHGs82K9buIjEw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cutover: It is the next step of the On-Live process. So, in a production environment, we can schedule the downtime to bring the actual data from the on-premises environment, import the data, and make sure that the on-premises database and application are down. Once it is done we can switch from the on-premises environment to the AWS completely.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Post Go-Live:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Last step of migration. We should make sure there is no problem after go-live. Stability, ongoing support; access, performance, integration. Ongoing support can continue for 2 weeks, more or less depending on the complexity of the application.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>rds</category>
      <category>ec2</category>
      <category>mysql</category>
    </item>
    <item>
      <title>Automated user migration and management of AWS Identity and Access Management (IAM) resources</title>
      <dc:creator>Cansu Tekin</dc:creator>
      <pubDate>Fri, 24 May 2024 02:07:03 +0000</pubDate>
      <link>https://dev.to/cansu_tekin_b017634d64dfd/automated-user-migration-and-management-of-aws-identity-and-access-management-iam-resources-2j7c</link>
      <guid>https://dev.to/cansu_tekin_b017634d64dfd/automated-user-migration-and-management-of-aws-identity-and-access-management-iam-resources-2j7c</guid>
      <description>&lt;h2&gt;
  
  
  &lt;em&gt;Automated user migration and management of AWS Identity and Access Management (IAM) resources&lt;/em&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2APr78CMgUIOC2px6rFws54g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2APr78CMgUIOC2px6rFws54g.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this project based on a real-world scenario, I acted as Cloud Specialist with the mission to migrate users in an automated way and manage AWS IAM (Identity and Access Management) resources.&lt;/p&gt;

&lt;p&gt;There were 100 users that needed to be migrated and have MFA (Multi-factor authentication) enabled on their accounts, as this is a security best practice.&lt;/p&gt;

&lt;p&gt;Using GitBash with AWS CLI and Shell Script, I avoided repetitive and manual tasks in the AWS console and automated the processes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2A-RTS0j52RzHKrwWtakcSrw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3840%2F1%2A-RTS0j52RzHKrwWtakcSrw.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PART-1: On-Premises Migration to AWS&lt;/p&gt;

&lt;p&gt;Create 5 user groups, attach policies, and migrate users from the on-premise environment&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CloudAdmin: A&lt;/strong&gt;dministratorAccess, IAMUserChangePassword&lt;/p&gt;

&lt;p&gt;**NetworkAdmin: **VPCFullAccess, IAMUserChangePassword&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DatabaseAdmin:&lt;/strong&gt; AmazonRDSFullAccess, IAMUserChangePassword&lt;/p&gt;

&lt;p&gt;**LinuxAdmin: **AmazonEC2FullAccess, IAMUserChangePassword&lt;/p&gt;

&lt;p&gt;**Trainees: **ReadOnlyAccess, IAMUserChangePassword&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5120%2F1%2AuWQV2NIfh9S0X5MxFZkURA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F5120%2F1%2AuWQV2NIfh9S0X5MxFZkURA.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2956%2F1%2AvZELN007eYKQjCNOCqs0mg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2956%2F1%2AvZELN007eYKQjCNOCqs0mg.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PART-2: Enable MFA (MultiFactor Authentication) on your root and IAM users applying the IAM Password Policy&lt;/p&gt;

&lt;p&gt;Create a custom policy, named **EnforceMFAPolicy.json, **for the MFA and add it to each user group, then enable it for root and each IAM user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3896%2F1%2AzEj-Dse9p-RwFI3IsDMifQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F3896%2F1%2AzEj-Dse9p-RwFI3IsDMifQ.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2896%2F1%2A99CmdacM308nl9EXLfEatw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F2896%2F1%2A99CmdacM308nl9EXLfEatw.png"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cloudcomputing</category>
      <category>aws</category>
      <category>multiplatform</category>
      <category>iam</category>
    </item>
  </channel>
</rss>
