| title | Elastic Beanstalk | |
|---|---|---|
| description | Get started with Elastic Beanstalk (EB) on LocalStack | |
| tags |
|
import FeatureCoverage from "../../../../components/feature-coverage/FeatureCoverage";
Elastic Beanstalk (EB) is a managed platform-as-a-service (PaaS) provided by Amazon Web Services (AWS) that simplifies the process of deploying, managing, and scaling web applications and services. Elastic Beanstalk orchestrates various AWS services, including EC2, S3, SNS, and Elastic Load Balancers. Elastic Beanstalk also supports various application environments, such as Java, .NET, Node.js, PHP, Python, Ruby, Go, and Docker.
LocalStack allows you to use the Elastic Beanstalk APIs in your local environment to create and manage applications, environments and versions. The supported APIs are available on our API Coverage section, which provides information on the extent of Elastic Beanstalk's integration with LocalStack.
This guide is designed for users new to Elastic Beanstalk and assumes basic knowledge of the AWS CLI and our awslocal wrapper script.
Start your LocalStack container using your preferred method. We will demonstrate how to create an Elastic Beanstalk application and environment with the AWS CLI.
To create an Elastic Beanstalk application, you can use the CreateApplication API.
Run the following command to create an application named my-app:
awslocal elasticbeanstalk create-application \
--application-name my-app{
"Application": {
"ApplicationArn": "arn:aws:elasticbeanstalk:us-east-1:000000000000:application/my-app",
"ApplicationName": "my-app",
"DateCreated": "2023-08-24T05:55:57.603443Z"
}
}You can also use the DescribeApplications API to retrieve information about your application.
Run the following command to retrieve information about the my-app application, we created earlier:
awslocal elasticbeanstalk describe-applications \
--application-names my-appTo create an Elastic Beanstalk environment, you can use the CreateEnvironment API.
Run the following command to create an environment named my-environment:
awslocal elasticbeanstalk create-environment \
--application-name my-app \
--environment-name my-environment{
"EnvironmentName": "my-environment",
"EnvironmentId": "4fcae3fb",
"ApplicationName": "my-app",
"DateCreated": "2023-08-24T05:57:59.889966Z",
"EnvironmentArn": "arn:aws:elasticbeanstalk:us-east-1:000000000000:applicationversion/my-app/version"
}You can also use the DescribeEnvironments API to retrieve information about your environment.
Run the following command to retrieve information about the my-environment environment, we created earlier:
awslocal elasticbeanstalk describe-environments \
--environment-names my-environmentTo create an Elastic Beanstalk application version, you can use the CreateApplicationVersion API.
Run the following command to create an application version named v1:
awslocal elasticbeanstalk create-application-version \
--application-name my-app \
--version-label v1{
"ApplicationVersion": {
"ApplicationVersionArn": "arn:aws:elasticbeanstalk:us-east-1:000000000000:applicationversion/my-app/v1",
"ApplicationName": "my-app",
"VersionLabel": "v1",
"DateCreated": "2023-08-24T05:59:58.166021Z"
}
}You can also use the DescribeApplicationVersions API to retrieve information about your application version.
Run the following command to retrieve information about the v1 application version, we created earlier:
awslocal elasticbeanstalk describe-application-versions \
--application-name my-appLocalStack's Elastic Beanstalk implementation is limited and lacks support for installing application and running it in a local Elastic Beanstalk environment.
LocalStack also does not support the eb CLI tool.
However, you can use other integrations, such as AWS CLI & Terraform, to mock the Elastic Beanstalk APIs and test your workflow locally.