Prerequisite:
Make sure you already config AWS CodeDeploy for your desired AWS EC2 server. Check this blog if you want to set it up.
Steps:
- Install Jenkins Plugins:
Amazon Web Services SDK
,AWS CodeDeploy Plugin for Jenkins
,Bitbucket Plugin
- Generate key, if you don’t have one already:
$ ssh-keygen -o -a 100 -t ed25519
- Add public key into bitbucket
Access Keys
list:
- Add bitbucket webhook to notify Jenkin
- Add private key into Jenkins:
- Go to AWS console and generate a AWS access key:
AWS Access and Secret keys to use for this deployment. At minimum the keys must be allowed to executecodedeploy:*
ands3:Put*
. It’s a best practice to have these keys be from an IAM role with limited scope.
If your Jenkins install is running on an EC2 instance with an associate IAM role, you can leave these fields blank. You will just need to ensure that the role has the correct policies.
- Add AWS access and secret keys to Jenkins:
- In Jenkins configuration, click
Build when a change is pushed to BitBucket
andAdd timestamps to the Console Output
Add
Post-build Action
->Deploy an application to AWS CodeDeploy
- finish and test
Go ahead and testing your whole workflow by pushing some noticeable code changes to bitbucket.
1 comment