eb create
Description
Creates a new environment and deploys an application version to it.
Note
-
To use eb create on a .NET application, you must create a deployment package as described in Creating a Source Bundle for a .NET Application, then set up the CLI configuration to deploy the package as an artifact as described in Deploying an Artifact Instead of the Project Folder.
-
Creating environments with the EB CLI requires a service role. You can create a service role by creating an environment in the Elastic Beanstalk console. If you don't have a service role, the EB CLI attempts to create one when you run
eb create
.
You can deploy the application version from a few sources:
-
By default: from the application source code in the local project directory.
-
Using the
--version
option: from an application version that already exists in your application. -
When your project directory doesn't have application code, or when using the
--sample
option: from a sample application, specific to your environment's platform.
Syntax
eb create
eb create environment-name
An environment name must be between 4 and 40 characters in length, and can only contain letters, numbers, and hyphens. An environment name can't begin or end with a hyphen.
If you include an environment name in the command, the EB CLI doesn't prompt you to make any selections or create a service role.
If you run the command without an environment name argument, it runs in an interactive flow, and prompts you to enter or select values for some settings. In this interactive flow, in case you are deploying a sample application, the EB CLI also asks you if you want to download this sample application to your local project directory. This enables you to use the EB CLI with the new environment later to run operations that require the application's code, like eb deploy.
Options
None of these options are required. If you run eb create without any options, the EB CLI prompts you to enter or select a value for each setting.
Name |
Description |
---|---|
or
|
Set the environment as the default environment for the current repository. |
|
Use platform settings from a saved configuration in
|
or
|
The subdomain name to prefix the CNAME DNS entry that routes to your website. Type: String Default: The environment name |
or
|
Attaches a database to the environment. If you run eb create with the |
or
|
The database engine type. If you run eb create with this option, then EB CLI launches the environment with a database attached
even if you didn't run the command with the Type: String Valid values: |
or
|
The type of Amazon EC2 instance to use for the database. If you run eb create with this option, then EB CLI launches the environment
with a database attached even if you didn't run the command with the Type: String Valid values: See Option Values. |
or
|
The password for the database. If you run eb create with this option, then EB CLI launches the environment with a database
attached even if you didn't run the command with the |
or
|
The number of gigabytes (GB) to allocate for database storage. If you run eb create with this option, then EB CLI launches the
environment with a database attached even if you didn't run the command with the Type: Number Valid values:
|
or
|
The user name for the database. If you run eb create with this option, then EB CLI launches the environment with a database
attached even if you didn't run the command with the |
or
|
Allows you to specify the database engine version. If this flag is present, the environment
will launch with a database with the specified
version number, even if the |
|
The load balancer type. Type: String Valid values: Default: |
--env-group-suffix |
Group name to append to the environment name. Only for use with Compose Environments. |
|
Environment properties in a comma-separated list with the format
|
or
|
The instance profile with the IAM role with the temporary security credentials that your application needs to access AWS resources. |
or
|
The type of Amazon EC2 instance to use in the environment. Valid values: See Option Values. |
or
|
The name of the Amazon EC2 key pair to use with the Secure Shell (SSH) client to securely log in to the Amazon EC2 instances running your Elastic Beanstalk application. If you include this option with the eb create command, the value you provide overwrites any key name that you might have specified with eb init. Valid values: An existing key name that is registered with Amazon EC2 |
|
List of component environments to create. Only for use with Compose Environments. |
or
|
The platform version (configuration) to use. You can specify a platform name, a platform name and version, a solution stack name, or a solution stack ARN. For example:
Use eb platform list to get a list of available configurations. If you specify the |
or
|
Preprocess and validate the environment manifest and configuration files in the source bundle. Validating configuration files can identify issues prior to deploying the application version to an environment. |
or
|
The AWS Region in which you want to deploy the application. For the list of values you can specify for this option, see AWS Elastic Beanstalk in the Regions and Endpoints topic in the Amazon Web Services General Reference. |
|
Deploy the sample application to the new environment instead of the code in your repository. |
|
Launch with the specified number of instances |
--service-role
servicerole |
Assign a non-default service role to the environment.
Note Do not enter an ARN, just the role name. Elastic Beanstalk prefixes the role name with the correct values to create the resulting ARN internally. |
|
Create the environment with a single Amazon EC2 instance and without a load balancer. Warning A single-instance environment isn't production ready. If the instance becomes unstable during deployment, or Elastic Beanstalk terminates and restarts the instance during a configuration update, your application can be unavailable for a period of time. Use single-instance environments for development, testing, or staging. Use load-balanced environments for production. |
|
Tag the resources in your environment. Tags are specified as a comma-separated list
of For valid values and more details, see Tag an Environment. |
or
|
Create a worker environment. Omit this option to create a web server environment. |
|
Set number of minutes before the command times out. |
|
Specifies the application version that you want deployed to the environment instead of the application source code in the local project directory. Type: String Valid values: An existing application version label |
|
Configure a VPC for your environment. When you include this option, the EB CLI prompts you to enter all required settings prior to launching the environment. |
|
Specifies subnets for database instances in a VPC. Required when |
|
Specifies subnets for Amazon EC2 instances in a VPC. Required when |
|
Launches your Elastic Load Balancing load balancer in a public subnet in your VPC. You can't specify this option with the |
|
Specifies subnets for the Elastic Load Balancing load balancer in a VPC. You can't specify this option with the |
|
Launches your environment in the specified VPC. |
|
Launches your Amazon EC2 instances in a public subnet in your VPC. You can't specify this option with the |
|
Specifies the security group ID or security group name. Required when |
Output
If successful, the command prompts you with questions and then returns the status of the create operation. If there were problems during the launch, you can use the eb events operation to get more details.
If you enabled CodeBuild support in your application, eb create displays information from CodeBuild as your code is built. For information about CodeBuild support in Elastic Beanstalk, see Using the EB CLI with AWS CodeBuild.
Examples
The following example creates an environment in interactive mode.
$
eb create
Enter Environment Name (default is tmp-dev):ENTER
Enter DNS CNAME prefix (default is tmp-dev):ENTER
Select a load balancer type 1) classic 2) application 3) network (default is 2):ENTER
Environment details for: tmp-dev Application name: tmp Region: us-west-2 Deployed Version: app-141029_145448 Environment ID: e-um3yfrzq22 Platform: 64bit Amazon Linux 2014.09 v1.0.9 running PHP 5.5 Tier: WebServer-Standard-1.0 CNAME: tmp-dev.elasticbeanstalk.com Updated: 2014-10-29 21:54:51.063000+00:00 Printing Status: ...
The following example also creates an environment in interactive mode. In this example, your project directory doesn't have application code. The command deploys a sample application and downloads it to your local project directory.
$
eb create
Enter Environment Name (default is tmp-dev):ENTER
Enter DNS CNAME prefix (default is tmp-dev):ENTER
Select a load balancer type 1) classic 2) application 3) network (default is 2):ENTER
NOTE: The current directory does not contain any source code. Elastic Beanstalk is launching the sample application instead. Do you want to download the sample application into the current directory? (Y/n):ENTER
INFO: Downloading sample application to the current directory. INFO: Download complete. Environment details for: tmp-dev Application name: tmp Region: us-west-2 Deployed Version: Sample Application Environment ID: e-um3yfrzq22 Platform: 64bit Amazon Linux 2014.09 v1.0.9 running PHP 5.5 Tier: WebServer-Standard-1.0 CNAME: tmp-dev.elasticbeanstalk.com Updated: 2017-11-08 21:54:51.063000+00:00 Printing Status: ...
The following command creates an environment without displaying any prompts.
$
eb create dev-env
Creating application version archive "app-160312_014028". Uploading test/app-160312_014028.zip to S3. This may take a while. Upload Complete. Application test has been created. Environment details for: dev-env Application name: test Region: us-west-2 Deployed Version: app-160312_014028 Environment ID: e-6fgpkjxyyi Platform: 64bit Amazon Linux 2015.09 v2.0.8 running PHP 5.6 Tier: WebServer-Standard CNAME: UNKNOWN Updated: 2016-03-12 01:40:33.614000+00:00 Printing Status: ...
The following command creates an environment in a custom VPC.
$
eb create dev-vpc --vpc.id vpc-0ce8dd99 --vpc.elbsubnets subnet-b356d7c6,subnet-02f74b0c --vpc.ec2subnets subnet-0bb7f0cd,subnet-3b6697c1 --vpc.securitygroup sg-70cff265
Creating application version archive "app-160312_014309". Uploading test/app-160312_014309.zip to S3. This may take a while. Upload Complete. Environment details for: dev-vpc Application name: test Region: us-west-2 Deployed Version: app-160312_014309 Environment ID: e-pqkcip3mns Platform: 64bit Amazon Linux 2015.09 v2.0.8 running Java 8 Tier: WebServer-Standard CNAME: UNKNOWN Updated: 2016-03-12 01:43:14.057000+00:00 Printing Status: ...