Pushing to an existing AWS Elastic Beanstalk application from the command line

前端 未结 3 848
孤街浪徒
孤街浪徒 2021-01-12 03:57

I\'ve used the web dashboard of Elastic Beanstalk to make an application and an environment. I know I can update that using the dashboard and uploading a zip file of my appl

相关标签:
3条回答
  • 2021-01-12 04:11

    Here are the steps to use "git aws.push" with your existing ElasticBeanstalk(EB) application. (These steps would be useful, specifically, for your question and also if you had setup EB using command line from another machine and are now setting up the tools on a new machine.)

    --

    Before you start

    You should have git installed on your system and your code should have a git repository.

    Download the latest "AWS Elastic Beanstalk Command Line Tool" and get it working. Find a link to download here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-reference-branch-environment.html

    The git aws.push command won't work yet cause your .ebextensions isn't configured. (Basically the .ebextensions stores your AWS Keys and info on EB instance to deploy to etc.)

    --

    Steps

    Run the eb --init command. (I do this from the root of my application code directory, and it automatically picks the name of the application. Maybe you can run the command from any other location as well and specify the name manually later.)

    AWS-ElasticBeanstalk-CLI-2.6.0/eb/linux/python2.7/eb (on Linux) or

    AWS-ElasticBeanstalk-CLI-2.6.0/eb/windows/eb.exe (on Windows)

    Enter you AWS Access Key ID and Secret Access Key

    Select the environment you configured your application with (The choices are AMI Linux 64bit, Ubuntu 32bit etc.). Basically select the options that you selected while creating your first EB instance.

    For Create RDS instance? [y/n]: Say n (You already have a DB instance or don't need one).

    Choose "Create a default instance profile".

    This would be the last step under eb --init and the script will exit.

    You can find more information on the above steps here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python.html

    --

    Environment ready to use

    The above steps will result in an .ebextensions directory (in ~/ I guess.)

    From now on just git commit the changes in your code and run git aws.push and the application will be deployed to AWS. It's quite cool once you have it all configured.

    Hope this helps. I jotted this down quickly. Let me know if you find the steps confusing, and I'll try to write it better.

    0 讨论(0)
  • 2021-01-12 04:16
    1. Created Application in aws.amazon.com->elastic beanstalk and trying to access the application on the eb CLI:

      a. When you provide eb init on console, CLI will prompt you to choose the region.

      b. Make sure to choose the same region as the one you choose on the webpage. (Note: if you don't choose the same region, it is going to take you into creating a whole new application. This was the mistake I did)

    2. Creating application using eb CLI first locally and then trying to access the same application on the webpage.

      a. $> eb console (from the app root directory, provided you did $> eb init initially)

      b. You can directly login into the website and make sure to choose the same region (eg: US - N California) where you configured the app locally and you should be able to see the application you deployed.

    0 讨论(0)
  • 2021-01-12 04:30

    To begin using git aws.push for your application you will have to initialize your git repository with AWS Beanstalk metadata. I'm assuming you are using git for version control (if you are not, you will have to initialize your project with git init first).

    $ cd angrywhopper
    $ git init #optional
    $ eb init
    ...
    $ git aws.push
    

    Walk through wizard steps, commit your code and push the app.

    Elastic Beanstalk container can be further customized by either rerunning eb init or with configuration file inside .ebextensions directory.

    If eb does not support something you would like to use, have a look at AWS Elastic Beanstalk API Command Line Interface, which is more feature-rich.

    More details on the configuration can be found in the following guides:

    • Customizing and Configuring AWS Elastic Beanstalk Environments
    • Customizing and Configuring a Python Container

    Make sure that service region in eb wizard is the same as region you pick in dashboard dropdown.

    NB: I would suggest to use temporary name in the beginning to make sure your app works as expected with the new workflow and then rename it to the original by rerunning eb init. Don't forget to terminate the temporary environment as soon as you done with the migration to avoid any unnecessary fees.

    0 讨论(0)
提交回复
热议问题