Upload builds from Jenkins to S3 / 05 Oct 2015 / Author: Haim Ari

    Estimated read time: 1 minutes

    If you are using Jenkins as your build server, you can easily and automatically upload your builds from Jenkins to S3 (AWS) This way, if you are using Auto Scaling you can pull your latest build from S3 which is fast and more robust service.

    After doing a one time configuration on your Jenkins server, syncing your builds to S3 is as easy as running a build. There is no need to run anything in addition running a build.

    Create a new S3 bucket

    jenkins

    Now go to dashboard -> Manage Jenkins -> Manage Plugins and select available tab. Find “S3 plugin” and install it.

    jenkins plugin

    Go to “Manage Jenkins” and select “Configure System”. look for “Amazon S3 Profiles”. Please provide a profile name, access key and secret access key for your AWS account. Create an IAM user with the relevant S3 permissions.

    jenkins s3_profile

    Now add a new item to create a “Free Style Project”

    jenkins freestyle

    Find “Post Build Actions” and add a new “Post Build Action” and select “Publish Artifacts to S3 Bucket”

    Configure your S3 Profile and define the files to upload.

    jenkins post_build

    That’s it !

    Now each time you run a (successful) build, your artifacts will automatically upload to your S3 bucket. This is very helpful if your are using a continues deployment tool. that way you can easily pull your builds from S3 instead of Jenkins. You can also configure “Versioning” in your S3 Bucket to keep the files of previous versions and restore them if needed.

    “You can use versioning to preserve, retrieve, and restore every version of every object stored in your Amazon S3 bucket.”