How To Integrate Jenkins With S3 Storage To Send The Build

We can integrate Jenkins with s3 storage using the AWS codedeploy plugin install on Jenkins.

How To Integrate Jenkins With S3 Storage To Send The Build:

First of all, we will have to create a user with programmatic access. you need to download the credentials file that keeps Access and Secret keys.

When you create a user then attach the policies as shown in the below figure.

Now the role attached to the user. we’ve created a user with the required policies.

Once you have created a role for Jenkins-deployment user. we need to create a bucket on S3.

Go to the S3 service and Click on “Create bucket“.

Inside the Bucket “codedeploy041“. we need to create another folder “codedeploy” where we will send the build-in “zip” format.

Check Out: How To List Git Remote Branches of Repository From Github

Step 1: Create an Application In CodeBuild

This is a part of the deployment application with Jenkins but I will just show you how to get that information in AWS CodeDeploy plugins on Jenkins.  

you will need to create an application and application deployment group when you’re going to integrate with AWS CodeDeploy.

Go to the CodeBuild Service -> Click on “Deploy “-> select “Application“.  

Click on “Create Application“.

Open the Application “MyFirstWebApp” and we need to create an “application deployment group“.

Give it any name.

Scroll down you will get the “AWS CodeDeploy Deployment Config” from here.

Jenkins Configuration With S3 Storage:

Now login to your Jenkins server and Click on “Manage Jenkins” -> “Manage Plugins” -> Click on “Available” -> search for “AWS CodeDeploy Plugin for Jenkins“.

Check Out: How To Install SQL Express Server 2019 On Windows 2012 / 2016 R2

Select them and click on “Install” and once it’s installed, you will see like as shown in the below figure. 

We have installed the required plugins and created IAM roles as well. Now we have to create a maven job for your project.

Click on “new items” and give a name to your project. 

how to upload file in s3 bucket using jenkins

Now give your project URL and you can change branch if you want.

jenkins with s3 storage

In this case, Keep it as same.

upload file in s3 using jenkins

Now we have to define the “pom.xml” path and give the “command” to make the build. Keep the other settings as same.

 jenkins aws codedeploy

Check Out: Create Jenkins Production Job For Maven Project On CentOS 7

In Post-build action, Select “Deploy an application to AWS CodeDeploy“. Once you have selected, you will find this information where you have created on CodeDeploy as shown in the above steps 1.

how to integrate amazon s3 with jenkins

Now we have to give an s3 bucket name “codedeploy041” and s3 prefix which we have created a folder inside this bucket “codedeploy“. you can keep the rest settings the same.

 install aws codedeploy jenkins

We have to provide the Access and Secret key which have created for “Jenkins-deployment” users in IAM.

jenkins upload to s3 bucket

Finally, click on Save.

Check Out: How To Configure Simple Notification Service(SNS) On AWS Cloud

Now go to Jenkins and click on “build now” and you can see the build is a success.

integrate s3 with jenkins

Now check on the S3 bucket. you must be seeing the file with zip format.

how to send build to s3 from jenkins

That’s it. install aws codedeploy jenkins

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment