Top AWS Elastic Beanstalk(2021) Interview Questions | CodeUsingJava
















Top AWS Elastic Beanstalk Interview Questions


  1. What is Elastic Beanstalk in AWS?
  2. How can we sign up for AWS Elastic Beanstalk?
  3. What languages are Supported by Elastic Beanstalk?
  4. What database solutions can we use with AWS Elastic Beanstalk?
  5. What are the Environment Types on AWS Elastic Beanstalk?
  6. Explain Elastic Beanstalk Workflow?
  7. What web containers does AWS Elastic Beanstalk supports?
  8. Explain Elastic Beanstalk Concepts?
  9. How to force https on elastic beanstalk?
  10. How can we run a worker with AWS Elastic Beanstalk?

What is Elastic Beanstalk in AWS?

Amazon Elastic Beanstalk is used for deploying and scaling web applications and services that are developed with Java, we can simply upload our code and Elastic Beanstalk automatically handles the deployment.It helps in deploying details of capacity provisioning, load balancing, auto-scaling, and application health monitoring.

How can we sign up for AWS Elastic Beanstalk?

For signing up for Elastic Beanstalk, we have to choose the Sign Up Now button on the detail page.We must contain an AWS Web Services account for accessing this service, we can prompy for creating when we begin the Elastic Beanstalk process.
After signing up, we can refer to the AWS Elastic Beanstalk Getting Started Guide.

What languages are Supported by Elastic Beanstalk?

Go
Java SE
Java with Tomcat
NET on Windows Server with IIS
Node.js
PHP
Python
Ruby
Packer Builder

What database solutions can we use with AWS Elastic Beanstalk?

AWS cannot be bind to any specific data persistence technology, we can have options for choosing such as Amazon DynamoDB, Amazon Relational Database Service, Oracle, Microsoft SQL Server or any other desired relational database services running on the Amazon EC2.

What are the Environment Types on AWS Elastic Beanstalk?

There are 2 types of environment types:
Load-balancing, Autoscaling Environment - helps in starting additional instances for accomodating increase the load on our application.
Single-Instance Environment - helps in containing AWS EC2 instance with an Elastic IP address.

Explain Elastic Beanstalk Workflow?


Beanstalk

What web containers does AWS Elastic Beanstalk supports?

There are 3 types of web containers:
Tomcat
Passenger
Puma

Explain Elastic Beanstalk Concepts?

Application - helps in includes environments, versions, and environment configurations.
Application Version - helps in referring a specific, label iteration of deployable code for a web application.
Environment - helps in running only a single application version at one time.
Environment Tier - helps in determining provision resources for supporting an application that handles HTTP requests or an application that pulls tasks from a queue.
Environment Configuration - helps in identifying a collection of parameters and setting and define how an environment and its associated resources behave.

How to force https on elastic beanstalk?

OPTION - 1
files:
    "/etc/httpd/conf.d/ssl_rewrite.conf":
        mode: "000644"
        owner: root
        group: root
        content: |
            RewriteEngine On
            <If "-n '%{HTTP:X-Forwarded-Proto}' && %{HTTP:X-Forwarded-Proto} != 'https'">
            RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
            </If>

OPTION - 2
Resources:
 AWSEBV2LoadBalancerListener:
  Type: AWS::ElasticLoadBalancingV2::Listener
  Properties:
    LoadBalancerArn:
      Ref: AWSEBV2LoadBalancer
    Port: 80
    Protocol: HTTP
    DefaultActions:
      - Type: redirect
        RedirectConfig:
          Host: "#{host}"
          Path: "/#{path}"
          Port: "443"
          Protocol: "HTTPS"
          Query: "#{query}"
          StatusCode: "HTTP_301"


How can we run a worker with AWS Elastic Beanstalk?


files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_celeryd.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash

      # Get django environment variables
      celeryenv=`cat /opt/python/current/env | tr '\n' ',' | sed 's/export //g' | sed 's/$PATH/%(ENV_PATH)s/g' | sed 's/$PYTHONPATH//g' | sed 's/$LD_LIBRARY_PATH//g'`

      # Create celery configuraiton script
      celeryconf="[program:celeryd]
      ; Set full path to celery program if using virtualenv
      command=/opt/python/run/venv/bin/celery worker -A myappname --loglevel=INFO

      directory=/opt/python/current/app
      user=nobody
      numprocs=1
      stdout_logfile=/var/log/celery-worker.log
      stderr_logfile=/var/log/celery-worker.log
      autostart=true
      autorestart=true
      startsecs=10

      ; Need to wait for currently executing tasks to finish at shutdown.
      ; Increase this if you have very long running tasks.
      stopwaitsecs = 600

      ; When resorting to send SIGKILL to the program to terminate it
      ; send SIGKILL to its whole process group instead,
      ; taking care of its children as well.
      killasgroup=true

      ; if rabbitmq is supervised, set its priority higher
      ; so it starts first
      priority=998

      environment=$celeryenv"

      # Create the celery supervisord conf script
      echo "$celeryconf" | tee /opt/python/etc/celery.conf

      # Add configuration script to supervisord conf (if not there already)
      if ! grep -Fxq "[include]" /opt/python/etc/supervisord.conf
          then
          echo "[include]" | tee -a /opt/python/etc/supervisord.conf
          echo "files: celery.conf" | tee -a /opt/python/etc/supervisord.conf
      fi

      # Reread the supervisord config
      supervisorctl -c /opt/python/etc/supervisord.conf reread

      # Update supervisord in cache without restarting all services
      supervisorctl -c /opt/python/etc/supervisord.conf update

      # Start/Restart celeryd through supervisord
      supervisorctl -c /opt/python/etc/supervisord.conf restart celeryd