> For the complete documentation index, see [llms.txt](https://freundcloud.gitbook.io/devops-examples-from-real-life/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://freundcloud.gitbook.io/devops-examples-from-real-life/cloud-platforms/aws/services/elastic-beanstalk.md).

# AWS Elastic Beanstalk

## Overview

Elastic Beanstalk is a Platform as a Service (PaaS) for deploying and scaling web applications and services.

## Real-life Use Cases

* **Cloud Architect:** Rapidly prototype and deploy web apps.
* **DevOps Engineer:** Automate blue/green deployments for zero downtime.

## Terraform Example

```hcl
resource "aws_elastic_beanstalk_environment" "app_env" {
  name                = "my-app-env"
  application         = aws_elastic_beanstalk_application.app.name
  solution_stack_name = "64bit Amazon Linux 2 v3.3.6 running Python 3.8"
}

resource "aws_elastic_beanstalk_application" "app" {
  name = "my-app"
}
```

## AWS CLI Example

```sh
aws elasticbeanstalk create-application --application-name my-app
aws elasticbeanstalk create-environment --application-name my-app --environment-name my-app-env --solution-stack-name "64bit Amazon Linux 2 v3.3.6 running Python 3.8"
```

## Best Practices

* Use environment variables for configuration.
* Enable enhanced health reporting.

## Common Pitfalls

* Not versioning application deployments.
* Ignoring environment health warnings.

> **Joke:** Why did Elastic Beanstalk get so popular? It always knew how to grow on you!
