# `eb init` and `eb create` [TOC] ###### tags: `aws` `eb` --- ## `eb init` ```shell % eb init \ -k {keyname} \ -p {platform-version} \ --profile {profile} \ --region {region} \ [application-name] ``` ### Option `-k` 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. ### Option `-p` The platform version to use. You can specify - a platform, - a platform and version, - a platform branch, - a solution stack name, - or a solution stack ARN. Use [**`eb platform list`**](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-platform.html#eb3-platform-list) to get a list of available configurations. ### Common Option `--profile` Use a specific profile from your AWS credentials file. ### Common Option `--region` Use the specified region. ### `[application-name]` Optional. If not specified, **`eb init`** will use the current directory name as the application name. ## `eb create` Creates a new environment and deploys an application to it, from the application source code in the local project directory. :::info ```shell % date "+%Y%m%d%H%M%S" ``` ::: ```shell % eb create \ -c {subdomain-name} \ --elb-type {type} \ --envvars {name1=value1,name2=value2} \ -i \ -im {number-of-instances} \ -ix {number-of-instances} \ -p {platform-version} \ -pr \ -r {region} \ --scale {number-of-instances} \ --vpc \ --vpc.ec2subnets {subnet1,subnet2} \ --vpc.elbpublic \ --vpc.elbsubnets {subnet1,subnet2} \ --vpc.id {id} \ --vpc.publicip \ --vpc.securitygroups {securitygroup1,securitygroup2} \ --profile {profile} \ --region {region} \ [environment-name] ``` ### Option `-c` The **subdomain name** to prefix the CNAME DNS entry that routes to your website. Default: The environment name. ### Option `--elb-type` The [load balancer type](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.elb.html); valid values: - **`classic`** - **`application`** (default) - **`network`** ### Option `--envvars` [Environment properties](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-softwaresettings.html) in a **comma-separated list** with the format **`name=value`**. ### Option `-i` The Amazon EC2 **[instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html)** that you want your environment to use. If you don't specify this option, Elastic Beanstalk provides a default instance type. ### Option `-im` The minimum number of Amazon EC2 instances that you require your environment to have. Default: **`1`**. ### Option `-ix` The maximum number of Amazon EC2 instances you allow your environment to have. Default: **`4`**. ### Option `-p` The platform version to use. You can specify - a platform, - a platform and version, - a platform branch, - a solution stack name, - or a solution stack ARN. Use [**`eb platform list`**](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-platform.html#eb3-platform-list) to get a list of available configurations. ### Option `-pr` 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. ### Option `-r` The AWS Region where you want to deploy the application. For the list of values you can specify for this option, see [AWS Elastic Beanstalk Endpoints and Quotas](https://docs.aws.amazon.com/general/latest/gr/elasticbeanstalk.html) in the AWS General Reference. ### Option `--scale` Launch with the specified number of instances ### Option `--vpc` 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. ### Option `--vpc.ec2subnets` Specifies subnets for Amazon EC2 instances in a VPC. Required when **`--vpc.id`** is specified. ### Option `--vpc.elbpublic` Launches your Elastic Load Balancing load balancer in a public subnet in your VPC. ### Option `--vpc.elbsubnets` Specifies subnets for the Elastic Load Balancing load balancer in a VPC. ### Option `--vpc.id` Launches your environment in the specified VPC. ### Option `--vpc.publicip` Launches your Amazon EC2 instances in a public subnet in your VPC. ### Option `--vpc.securitygroups` Specifies security group IDs. Required when **`--vpc.id`** is specified. ### Common Option `--profile` Use a specific profile from your AWS credentials file. ### Common Option `--region` Use the specified region. ### `[environment-name]` - 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. ## References - [AWS Elastic Beanstalk » Developer Guide » `eb init`](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-init.html) - [AWS Elastic Beanstalk » Developer Guide » Common options](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cmd-options.html)