3

My Settings: - I've got a multidocker application specified in my Dockerrun.aws.json file. - The images of my applications are stored on ECR.

In the AWS console for Elastic Beanstalk, I can "upload and deploy" a new Dockerrun.aws.json file. And then Elastic Beanstalk deploys that version.

Is it possible to do the same ("upload and deploy") via the aws elasticbeanstalk command line?

The closest thing I found was aws elasticbeanstalk rebuild-environment --environment-id $ENVIRONMENT_ID. But that only rebuilds the existing environment with existing Dockerrun.aws.json file. What if I want to deploy my environment with another version of my Dockerrun.aws.json file in the cli?

1
  • On AWS, EBS == Elastic Block Store. Not Elastic Beanstalk. Commented Jul 13, 2018 at 13:26

1 Answer 1

3

Yes, you can create a new deployment using the AWS CLI, and as you figured, RebuildEnvironment is not the API call. You are looking for a combination of three calls -- one to S3, and two to Beanstalk

  1. create a zip file of your application code
  2. Upload the zip file to S3. Note the bucket and key names (This would make the new version available to AWS and hence to Beanstalk)
  3. perform a call to ElasticBeanstalk's CreateApplicationVersion API:

    aws elasticbeanstalk create-application-version --application-name <beanstalk-app> --version-label <a unique label for this version of code> --description <description of your changes> --source-bundle S3Bucket="<bucket name previously noted",S3Key="<key name previously noted"
    
  4. perform a call to Beanstalk's UpdateEnvironment API:

    aws elasticbeanstalk update-environment --environment-name <name of environment> --version-label <label of app. version created above>
    

Clearly, this is tedious, so I also suggest you look into deploying through the EBCLI, which does all these things for you through a single command -- eb deploy

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.