2

I've been using the AWS console to upload a WAR file for deployment. Now I want to do it from the command line. I've been following this guide and see eb init and read the help with eb init --help and eb --help, but the only option is to create a new application.

usage: eb init <application_name> [options ...]

Initializes your directory with the EB CLI. Creates the application.

positional arguments:
  application_name      application name

How do I link my local source project directory to an existing application in AWS console?

I would expect a command like eb link or something, like how you can just add a Git remote with Heroku and automatically link an existing project to an existing app.

Chloe
  • 25,162
  • 40
  • 190
  • 357

4 Answers4

4

When you perform eb init in the directory containing your source code, eb will prompt you for an application name and an environment name. This way you can link your source code to what ever application/environment is deployed on Beanstalk.

progfan
  • 2,454
  • 3
  • 22
  • 28
2

It worked after I got the AWS CLI keys for the project and ran aws configure. I had old keys in ~/.aws/ from a different project from perhaps a decade ago that used a different format. Once I got new keys, that were given permission for these particular apps, and ran aws configure and set the region, then eb init would present a menu of applications to choose from. The command aws elasticbeanstalk describe-applications has to work first before eb can work. I was expecting it would ask for a username and password, like Heroku does.

Install aws and eb command line tools:

  1. Install awscli
  2. Get keys from AWS admin devops.
  3. aws configure (Example Region: 'us-east-1')
  4. aws elasticbeanstalk describe-applications
  5. Install Python
  6. pip install awsebcli --upgrade --user
  7. Add eb to your PATH, probably %USERPROFILE%\AppData\Roaming\Python\Python37\Scripts
  8. eb init
  9. eb list / eb logs / eb ssh / eb status / eb config / eb help
Chloe
  • 25,162
  • 40
  • 190
  • 357
0

Beanstalk differs from Heroku in this workflow, unless you are using CodeCommit. I am assuming you are just using S3 to store your application versions.

The EBCLI command to do this is:
eb create-application-version

You can specify an application, a version label, as well as either a CodeCommit repository, a codeBuild build, or a source bundle in S3. API docs

You will need to run a separate command before create-application-version to upload to your S3 bucket.
Using the CLI:
aws s3 cp <filename> <s3bucket> API docs

You can also use the console.

It seems like that guide skips initializing your local git repository. For linking your local source project to beanstalk, make sure you have initialized a local git repository. Then you can link your workspace and application using eb init. more about EB CLI and Git

0

Based on my understanding, your question is that you had a project directory on your PC and run your app at the localhost, now you want to run it in the AWS Elastic Beanstalk to make it public.

If you have created an EB application in the EB management console and uploaded your bundled source code, the source code becomes an application version, you need to deploy it into one of your environment using the EB management console, like this: Figure of the management console.

Then the EB platform(container) will take care of that and run your server automatically as long as you set up the command which your app uses to run the server, the proxy, and other configurations either through the EB management console -> [Your environment] -> configuration or using the .ebextensions file.

If everything is well, you can visit your app's home page through the environment URL at that time.

Leo
  • 1