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.
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“.
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.
Now give your project URL and you can change branch if you want.
In this case, Keep it as same.
Now we have to define the “pom.xml” path and give the “command” to make the build. Keep the other settings as same.
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.
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.
We have to provide the Access and Secret key which have created for “Jenkins-deployment” users in IAM.
Finally, click on Save.
Now go to Jenkins and click on “build now” and you can see the build is a success.
Now check on the S3 bucket. you must be seeing the file with zip format.
That’s it. install aws codedeploy jenkins