{"id":564,"date":"2022-03-16T03:44:50","date_gmt":"2022-03-16T03:44:50","guid":{"rendered":"https:\/\/192.168.1.3\/wordpress\/?p=564"},"modified":"2024-10-17T12:57:41","modified_gmt":"2024-10-17T12:57:41","slug":"aws-developer-associate-dva-c01-review-material-elasticbeanstalk","status":"publish","type":"post","link":"https:\/\/mylinuxsite.com\/wordpress\/?p=564","title":{"rendered":"AWS Developer Associate (DVA-C01) Review Material \u2013 ElasticBeanstalk"},"content":{"rendered":"\n<!--more continue readinG-->\n\n\n\n<h4 class=\"wp-block-heading\"><strong>General<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>AWS Elastic Beanstalk is an easy-to-use service for <strong>deploying and scaling web applications<\/strong> and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS<\/li><li><strong>Concepts<\/strong>:<ol><li><strong>Application<\/strong>: A logical collection of Elastic Beanstalk components, including&nbsp;<em>environments<\/em>,&nbsp;<em>versions<\/em>, and&nbsp;<em>environment configurations<\/em>. <em><span style=\"color:#f20707\" class=\"has-inline-color\">In Elastic Beanstalk an application is conceptually similar to a folder<\/span><\/em><\/li><li><strong>Application version<\/strong>: Refers to a specific, labelled iteration of deployable code for a web application. An application version<span style=\"color:#ed0505\" class=\"has-inline-color\"> points to an  S3 object that contains the deployable code<\/span>, such as a Java WAR file<\/li><li><strong>Environment<\/strong>: A collection of AWS resources running an application version.<em> Each environment runs only one application version at a time<\/em>, however, you can run the same application version or different application versions in many environments simultaneously<\/li><li><strong>Environment tier<\/strong>: &nbsp;Designates the type of application that the environment runs, and determines what resources Elastic Beanstalk provisions to support it.<ul><li>Has 2 types:<ol><li>&nbsp;<a href=\"https:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/concepts-webserver.html\">Web Server Environment Tier<\/a> &#8211; An application that serves HTTP requests<\/li><li><a href=\"https:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/concepts-worker.html\">Worker Environment Tier<\/a> &#8211; A backend environment that pulls tasks from an SQS queue<\/li><\/ol><\/li><\/ul><\/li><li><strong>Environment configuration<\/strong>: &nbsp;Identifies a collection of parameters and settings that define how an environment and its associated resources behave.<\/li><li><strong>Saved configuration<\/strong>: &nbsp;A template that you can use as a starting point for creating unique environment configurations.<\/li><li><strong>Platform<\/strong>: A combination of an operating system, programming language runtime, web server, application server, and Elastic Beanstalk components. You design and target your web application to a platform (e.g. Go, Java, Python)<\/li><\/ol><\/li><li>Use CloudFormation behind the scene.<\/li><li>Uses one (1) S3 to store environment settings <\/li><li>Can <strong>clone environments<\/strong> (if with DB will not clone the DB)<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Configuration<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Presets<\/strong>:<ul><li>Single, HA,Custom<\/li><\/ul><ul><li>On-demand or Spot<\/li><\/ul><\/li><li><strong>Software<\/strong><ul><li>Enable X-Ray, log to S3 or CloudWatch.<\/li><li>Set environment properties<\/li><\/ul><\/li><li><strong>Instances<\/strong><ul><li>Root Volume, SG<\/li><\/ul><\/li><li><strong>Capacity<\/strong><ul><li>ASG (min,max,fleet composition) , Instance Type, Scaling Trigger<\/li><\/ul><\/li><li><strong>Load balancer<\/strong><ul><li>ELB Type (ALB\/NLB\/CLB). <strong>Once set it cannot be changed.<\/strong><ul><li>To change need to manually re-create the configuration<\/li><li>Deploy the environment<\/li><li>Do a URL swap or Route 53 update.<\/li><\/ul><\/li><li>Listeners<\/li><\/ul><\/li><li><strong>Network<\/strong><ul><li>VPC<\/li><li>Instance, ELB, DB subnets<\/li><\/ul><\/li><li><strong>Database<\/strong><ul><li>RDS DB Engine (MySQL, SQLServer, Oracle, PostgreSQL)<\/li><li>username\/password<\/li><li>DB Lifecycle is tied to the Beanstalk environment<\/li><li><strong>To de-couple from Beanstalk<\/strong><ol><li>Create an RDS snapshot for backup<\/li><li>Enable RDS deletion protection<\/li><li>Create a new environment (manually) without the RDS.<\/li><li>The application version should still point to the existing RDS.<\/li><li>Perform a URL Swap or Route 53 DNS change<\/li><li>Terminate the old environment.<\/li><li>Delete the CloudFormation stack of the old environment<\/li><\/ol><\/li><\/ul><\/li><li><strong>Security<\/strong><ul><li>Service Role<\/li><li>Instance Role and SSH KP<\/li><\/ul><\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Deployment Mode<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>All at once<\/strong><ul><li>The quickest deployment method. <\/li><li>Suitable if you can accept a short loss of service, and if quick deployments are important to you. <\/li><li>With this method, Elastic Beanstalk deploys the new application version to each instance all at once.<\/li><li><strong>Has downtime<\/strong><\/li><\/ul><\/li><li><strong>Rolling<\/strong><ul><li>Suitable if you can&#8217;t accept any period of completely lost service. <\/li><li>Bucket\/Batch size concept &#8211; the no. of instances to be updated<\/li><li>Application is deployed to the environment one batch of instances at a time<\/li><li>Can set the batch size (Fixed or percentage)<\/li><li><strong>NO downtime but with<em> reduced capacity<\/em><\/strong><\/li><li>No additional cost.<\/li><\/ul><\/li><li><strong>Rolling with additional batch<\/strong><ul><li>Suitable if you must maintain the same bandwidth throughout the deployment. <\/li><li>Elastic Beanstalk launches an extra batch of instances, then performs a rolling deployment.<\/li><li><strong>NO downtime and NO<em> reduced capacity<\/em><\/strong><\/li><li>Small additional cost due to new instances being created<\/li><\/ul><\/li><li><strong>Immutable<\/strong><ul><li>&nbsp;A<strong>  second temporary Auto Scaling group<\/strong> (with new instances) is launched in your environment and the new version serves traffic alongside the old version until the new instances pass health checks.<\/li><li>When everything is passed, the new instances will be <strong>moved<\/strong> to the current ASG and the old instances will be terminated.<\/li><li>Quick rollback<\/li><\/ul><ul><li><strong>NO downtime and NO<em> reduced capacity<\/em><\/strong><\/li><li>Higher additional cost<\/li><\/ul><\/li><li><strong>Traffic splitting<\/strong><ul><li>A canary testing deployment method. <\/li><li>Suitable if you want to test the health of your new application version <strong>using a portion of incoming traffic<\/strong> while keeping the rest of the traffic served by the old application version<\/li><li>A<strong> second temporary Auto Scaling group<\/strong> (with new instances) is launched in your environment and the new version serves traffic alongside the old version until the new instances pass health checks.<\/li><li>A small % of traffic is sent to the temp ASG. Traffic will be monitored for a configurable amount of time,<\/li><li> <strong>When health is ok during the monitoring period<\/strong>, the new instances will be moved to the current ASG and the old instances will be terminated.<\/li><\/ul><\/li><li><strong>Blue\/green<\/strong><ul><li>Not really a feature of Elastic BeanStalk<\/li><li>Done manually:<ol><li>Create a <strong>new environment<\/strong><\/li><li>Validate (can use Route 53 to route a small % of traffic to the new environment)<\/li><li>If ok then use Elastic Beanstalk &#8216;SWAP URL&#8217; to switch traffic.<\/li><\/ol><\/li><\/ul><\/li><li>https:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/using-features.deploy-existing-version.html<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Version Lifecycle<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li> Tells Elastic Beanstalk to delete application versions <strong>that are old<\/strong> or to delete application versions when the <strong>total number of versions for an application exceeds a specified number<\/strong><ul><li>Specify how many to keep, or Age <\/li><li>If to keep the source bundle in S3<\/li><\/ul><\/li><li>Applies an application&#8217;s lifecycle policy each time you create a new application version.<\/li><li>Deletes up to 100 versions each time the lifecycle policy is applied.<\/li><li>The application version quota applies across all applications in a region.<\/li><li>The quota is 1000\/region.<\/li><li>Need to specify the role that EB will use to manage the version<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Beanstalk Extension (.ebextensions)<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>Configure the environment and customize the AWS resources using a config file embedded in the source code bundle.<\/li><li>Must be in the directory <strong>.ebextensions<\/strong> and file must end with <strong>.config<\/strong> (e.g. <strong>.ebextensions\/network-load-balancer.config<\/strong>)<\/li><li>Can add resources e.g. ElasticCache, RDS.<\/li><li>Must be in YAML or JSON format<\/li><li>Use <strong>option_settings<\/strong><\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Docker Deployment<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Single Docker<\/strong><ul><li>&nbsp;Use&nbsp;<code>docker-compose.yml<\/code>&nbsp;file to pull and run your image if you are using Docker Compose or,<\/li><li> <code><strong>Dockerrun.aws.json<\/strong><\/code> at root of source<\/li><li>Run plain  docker in an EC2 instance (<strong>no ECS<\/strong>) &nbsp;<\/li><\/ul><\/li><li><strong>Multicontainer Docker<\/strong><ul><li>Requires a configuration file Dockerrun.aws.json to create task definitions<\/li><li>Run docker in an ECS<\/li><\/ul><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[11],"tags":[],"class_list":["post-564","post","type-post","status-publish","format-standard","hentry","category-aws-review-notes"],"_links":{"self":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=564"}],"version-history":[{"count":21,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/564\/revisions"}],"predecessor-version":[{"id":1017,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/564\/revisions\/1017"}],"wp:attachment":[{"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mylinuxsite.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}