Elastic Beanstalk
3 minute read
Introduction
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 page, which provides information on the extent of Elastic Beanstalk’s integration with LocalStack.
Getting started
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.
Create an application
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
The following output would be retrieved:
{
"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-app
Create an environment
To 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
The following output would be retrieved:
{
"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-environment
Create an application version
To 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
The following output would be retrieved:
{
"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-app
Current Limitations
LocalStack’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.