Elastic Beanstalk, Docker and Continuous integration Elastic Beanstalk, Docker and Continuous integration jenkins jenkins

Elastic Beanstalk, Docker and Continuous integration


Basically it seems the update-environment call refuses to update a the same version number - and thats why we always rely on ${maven.build.timestamp} and friends. Here's your retouched pom :]

Notice I'm using properties - Thats the suggested style for the latest version (oops, someone forgot to update the docs).

I've decided to try it with the latest 1.4.0-SNAPSHOT. Here's what you should add to your profile:

<profiles>    <profile>        <id>awseb</id>        <properties>            <maven.deploy.skip>true</maven.deploy.skip>            <beanstalker.region>eu-west-1</beanstalker.region>            <beanstalk.applicationName>wisdom-demo</beanstalk.applicationName>            <beanstalk.cnamePrefix>wisdom-demo</beanstalk.cnamePrefix>            <beanstalk.environmentName>${beanstalk.cnamePrefix}</beanstalk.environmentName>            <beanstalk.artifactFile>${project.basedir}/target/${project.build.finalName}.zip</beanstalk.artifactFile>            <beanstalk.environmentRef>${beanstalk.cnamePrefix}.elasticbeanstalk.com</beanstalk.environmentRef>            <maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>            <beanstalk.s3Key>apps/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}-${maven.build.timestamp}.zip</beanstalk.s3Key>            <beanstalk.useLatestVersion>true</beanstalk.useLatestVersion>            <beanstalk.versionLabel>${project.artifactId}-${project.version}-${maven.build.timestamp}</beanstalk.versionLabel>            <beanstalk.applicationHealthCheckURL>/ping</beanstalk.applicationHealthCheckURL>            <beanstalk.instanceType>m1.small</beanstalk.instanceType>            <beanstalk.keyName>aldrin@leal.eng.br</beanstalk.keyName>            <beanstalk.iamInstanceProfile>aws-elasticbeanstalk-ec2-role</beanstalk.iamInstanceProfile>            <beanstalk.solutionStack>64bit Amazon Linux 2014.* running Docker 1.*</beanstalk.solutionStack>            <beanstalk.environmentType>SingleInstance</beanstalk.environmentType>        </properties>        <build>            <plugins>                <plugin>                    <groupId>br.com.ingenieux</groupId>                    <artifactId>beanstalk-maven-plugin</artifactId>                    <version>1.4.0-SNAPSHOT</version>                    <executions>                        <execution>                            <id>default-deploy</id>                            <phase>deploy</phase>                            <goals>                                <goal>upload-source-bundle</goal>                                <goal>create-application-version</goal>                                <goal>put-environment</goal>                            </goals>                        </execution>                    </executions>                </plugin>            </plugins>        </build>    </profile>

From the example above, just tweak your cnamePrefix and the latest three properties. Here's a rundown:

So if you want to deploy, simply:

$ mvn -Pawseb deploy

Or, if you want to boot it

from scratch the latest version (thus using useLatestVersion) once deployed, simply do:

$ mvn -Pawseb -Dbeanstalk.versionLabel= beanstalk:create-environment

By setting to blank the versionLabel, it effectively activates the useLatestVersion behaviour: When there isn't a version, use the latest one.

Oh, a deployment failed?

Easy peasy:

$ mvn -Pawseb beanstalk:rollback-version


Thank you for your explanation and the link to the blog post.I follow these step by step instructions and successfully deployed my first Wisdom application in a Docker container on AWS Elastic Beanstalk.

enter image description here

I then upgrade the Java source code, compiled with mvn package, tested locally and deployed again the new ZIP file using AWS Console.

My AWS Elastic BeansTalk environment was correctly updated.

enter image description here

So, it looks like the deployment problem you are observing is lying in the maven AWS Elastic Beanstalk plugin that deploys the code. Manual deploys work correctly. Since this maven plugin is a third-party, open-source project, I am not the right person to investigate this. I would suggest you to contact the project maintainer and / or open an issue in their Issue Tracking System

As a workaround, you can deploy manually (or script this procedure from your CI/CD environment) :

  1. Copy your artefact to your AWS Elastic Beanstalk bucket

aws s3 --region <REGION_NAME> cp ./target/YOUR_ARTIFACTID-1.0-SNAPSHOT.zip s3://<YOUR_BUCKET_NAME>/20141128-210900-YOUR_ARTIFACTID-1.0-SNAPSHOT.zip

  1. Create an application version with your zip file

aws elasticbeanstalk create-application-version --region <REGION_NAME> --application-name <YOUR_APPLICATION_NAME> --version-label 20141128-212100 --source-bundle S3Bucket=<YOUR_BUCKET_NAME>,S3Key=20141128-210900-YOUR_ARTIFACTID-1.0-SNAPSHOT.zip

  1. Deploy that version

aws elasticbeanstalk update-environment --region <YOUR_REGION_NAME> --environment-name <YOUR_ENVIRONMENT_NAME> --version-label 20141128-212100

These three steps might be automated from maven or jenkins, I will let you this as an exercise :-)