introduccion a elastic beanstalk aws roadshow bogota mexico
DESCRIPTION
TRANSCRIPT
![Page 1: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/1.jpg)
México D.F.
Implementación y gestión de websites/webapps
![Page 3: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/3.jpg)
Agenda • Qué es Elastic Beanstalk?
• Cómo funciona Elastic Beanstalk?
• Deployment de una aplicación PHP
• Zero Downtime Deployment
• Auto-Scaling
• Q&A
![Page 4: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/4.jpg)
Qué es AWS Elastic Beanstalk?
![Page 5: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/5.jpg)
Qué es AWS Elastic Beanstalk?
• Es un servicio utilizado para la implementación y gestión de aplicaciones
• Variedad de lenguajes disponibles: • Java • .NET • Python • Ruby • PHP • Docker • node.js
![Page 6: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/6.jpg)
Qué es AWS Elastic Beanstalk?
• Con sólo subir el código, Elastic Beansltak se encarga de las siguientes tareas: • Provisionamiento de recursos • Instalación de paquetes necesarios del Sistema Operativo • Deployment del código fuente • Escalamiento automático (adicionar o remover recursos) • Monitoreo
• Permite centralizar archivos de log en S3 y monitorear los mismos
• No se cargan tarifas adicionales, sólo se paga por los recursos de AWS que sean
necesarios para ejecutar sus aplicaciones
![Page 7: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/7.jpg)
Qué es AWS Elastic Beanstalk?
• Con Elastic Beanstalk, los desarrolladores cuentan con el control absoluto sobre los recursos de AWS que potencian la aplicación
• Se pueden realizar una gran variedad de funciones, entre otras: • Seleccionar el tipo de instancia Amazon EC2 más apropiado que coincida conlos requisitos
de memoria de la aplicación y la CPU. • Habilitar a instancias de Amazon EC2 para la resolución inmediata y directa de problemas • Mejorar de manera rápida la disponibildiad de la aplicación ejecutándola en más de una
zona de disponibilidad • Ajustar la configuración del servidor de la aplicación (por ejemplo, la configuración de JVM)
y pasar las variables de entorno
![Page 8: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/8.jpg)
Qué es AWS Elastic Beanstalk?
• Algunos de los recursos AWS que pueden ser provisionados e integrados: • Elastic Load Balancers • Auto-Scaling Groups • Instancias RDS • Tablas de DynamoDB • Nodos de ElastiCache • SQS (Simple Queue Service)
![Page 9: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/9.jpg)
Qué es AWS Elastic Beanstalk?
• Puede ser utilizado desde: 1. AWS Management Console 2. EB Command Line Interface (integración con Git) 3. AWS Command Line Interface 4. API usando las AWS SDKs
• Posiblidad de automatizar todo el ciclo de desarrollo
![Page 10: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/10.jpg)
Cómo funciona?
![Page 11: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/11.jpg)
Cómo funciona? Componentes:
1. Application 2. Application Version 3. Environment 4. Environment Configuration 5. Configuration Template
![Page 12: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/12.jpg)
Cómo funciona?
• Environment Tiers: • Web Server Tier • Worker Tier
• Environment Types: • Single Instance • Load Balancing, auto scaling
![Page 13: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/13.jpg)
Web Server Environment Tier
![Page 14: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/14.jpg)
Deployment de una aplicación PHP
![Page 15: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/15.jpg)
Creación del paquete con el código fuente
$ mkdir roadshowdemo
$ cd roadshowdemo/
$ cat << EOF >> index.php
> <?php
>
> echo "<h1>AWS Elastic Beanstalk PHP Sample Application</h1>\n";
>
> ?>
> EOF
$ zip ../roadshowdemo_v1.zip -r * .[^.]*
adding: index.php (stored 0%)
![Page 16: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/16.jpg)
![Page 17: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/17.jpg)
![Page 18: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/18.jpg)
![Page 19: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/19.jpg)
![Page 20: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/20.jpg)
![Page 21: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/21.jpg)
![Page 22: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/22.jpg)
![Page 23: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/23.jpg)
![Page 24: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/24.jpg)
![Page 25: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/25.jpg)
![Page 26: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/26.jpg)
Zero Downtime Deployment
![Page 27: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/27.jpg)
Zero Downtime Deployment • Actualización del código de la aplicación, sin interrumpir ni afectar el tráfico actual
• Consiste en crear un nuevo environment con la nueva versión, para luego realizar un
“swap” de URLs
• También conocido como “Blue/Green Deployment”
• Muy útil para automatizar nuevos releases con herramientas de CI
• Facilita rollbacks en caso de encontrar errores en la nueva versión, ya que la versión anterior todavía se encuentra disponible
![Page 28: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/28.jpg)
![Page 29: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/29.jpg)
Zero Downtime Deployment
$ cat << EOF >> index.php
> <?php
>
> echo "<h1>AWS Elastic Beanstalk PHP Sample Application</h1>\n";
>
> echo “<h2>This is Version 2</h2>\n”;
> ?>
> EOF
$ zip ../roadshowdemo_v2.zip -r * .[^.]*
adding: index.php (stored 0%)
![Page 30: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/30.jpg)
![Page 31: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/31.jpg)
![Page 32: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/32.jpg)
![Page 33: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/33.jpg)
![Page 34: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/34.jpg)
![Page 35: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/35.jpg)
![Page 36: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/36.jpg)
![Page 37: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/37.jpg)
![Page 38: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/38.jpg)
![Page 39: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/39.jpg)
![Page 40: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/40.jpg)
![Page 41: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/41.jpg)
![Page 42: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/42.jpg)
![Page 43: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/43.jpg)
![Page 44: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/44.jpg)
![Page 45: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/45.jpg)
![Page 46: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/46.jpg)
![Page 47: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/47.jpg)
Zero Downtime Deployment
• El swap de URLs también puede ser hecho con un registro de DNS propio del usuario
• Por ejemplo:
v1: roadshow.awsdemos.info CNAME roadshowdemo-env.elasticbeanstalk.com
v2: roadshow.awsdemos.info CNAME roadshowdemo-new-env.elasticbeanstalk.com
![Page 48: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/48.jpg)
Integración con RDS
![Page 49: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/49.jpg)
Integración con RDS
• Distintos escenarios posibles: 1. Crear una instancia RDS para cada environment 2. Usar instancias existentes de RDS 3. Usar otras bases de datos hosteadas en EC2
• Para evitar guardar las credenciales en el código, podemos pasar las mismas como
paramétros a los environments
• A continuación, mostraremos como usar una instancia RDS existente
![Page 50: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/50.jpg)
![Page 51: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/51.jpg)
![Page 52: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/52.jpg)
Accediendo a los parámetros del environment
![Page 53: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/53.jpg)
Auto-Scaling
![Page 54: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/54.jpg)
Auto-Scaling • Elastic Beanstalk escala automáticamente las aplicaciones
• Es posible escoger las condiciones en las cuales los eventos de escalado serán
ejecutados. Algunos ejemplos: • Utilización de CPU • Network Out / Network In • Latencia • Métricas propias generadas por la aplicación
• Control total sobre: cantidad de instancias a adicionar o remover, tiempo de espera
entre eventos, umbrales, etc
![Page 55: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/55.jpg)
Auto-Scaling • Usando la herramienta Apache Benchmark, vamos a demostrar como funciona Auto-
Scaling
• El siguiente comando generará 50.000 requests HTTP a nuestra aplicación
• La aplicación tiene reglas de Auto-Scaling configuradas para: • Adicionar instancias cuando el uso de CPU sea mayor a 50% durante 1 minuto • Remover instancias cuando el uso de CPU sea menor a 20% durante 1 minuto
$ ab -n 50000 -c 2 http://roadshowdemo-autoscale.elasticbeanstalk.com/index.php
![Page 56: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/56.jpg)
![Page 57: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/57.jpg)
![Page 58: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/58.jpg)
AWS Command Line Interface
![Page 59: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/59.jpg)
AWS Command Line Interface
$ aws elasticbeanstalk create-application --application-name RoadShowCLI \
--description "Sample app from AWS CLI”
• Creamos una aplicación
$ aws elasticbeanstalk create-application-version --application-name RoadShowCLI \
--version-label AWSCLIv1 \
--source-bundle S3Bucket=elasticbeanstalk-us-east-1-903745515320,S3Key=2014225usa-
roadshowdemo_asg.zip
• Creamos una primera versión de la aplicación. El paquete .zip se encuentra en S3
![Page 60: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/60.jpg)
AWS Command Line Interface
$ aws elasticbeanstalk create-configuration-template --application-name "RoadShowCLI" --template-name
AutoScalingCPUv2 --source-configuration
ApplicationName=RoadShowDemo,TemplateName="AutoScalingCPU v2”
• Guardamos la configuración de un ambiente existente (podemos crear una nueva)
$ aws elasticbeanstalk create-environment --application-name RoadShowCLI \
--version-label AWSCLIv1 --environment-name roadshow-cli --cname-prefix roadshow-cli --template-name
AutoScalingCPUv2
• Finalmente creamos el environment
![Page 61: Introduccion a elastic beanstalk aws roadshow bogota mexico](https://reader033.vdocuments.net/reader033/viewer/2022051323/5496aa6eac7959132e8b51b4/html5/thumbnails/61.jpg)
Q&A