How to automate the deployment process of static webpage using Jenkins hosted on AWS

For the past few days, I have been trying to link Jenkins to Github and or Bitbucket repos and publish to S3 bucket using AWS


>> Follow the steps of installing Git to your desktop(

>>You have an active account on Github and Bitbucket

>>You have a sample html file to added to your repo (Git )

>>You have cloned Git with Github and or Bitbucket

>>You have EC2 instance installed with Jenkins

>>You have IAM user setup with full rights to S3 Bucket

>>You have an S3 bucket created which is public

>>You have the private key and public key
>> You have port 8080 listening to all TCP connections set under ‘security group’ section of EC2

Here we will learn the following:

  • Create a job (to automate) in Jenkins to connect to Github/Bitbucket
  • Enable Jenkins to build post each commit to the repo
  • S3 bucket to publish your static webpage

First, we need to click ‘Manage Jenkins’-> ‘Manage Plugins’
Click on ‘Available’ tab at the top and type ‘S3 Publisher’
Click on ‘Install without restart’ and log off & log in to your Jenkins account

Once we have logged to our Jenkins user account with admin privileges.


Choose New item >> Enter the name of the Job


Choose Free Style Project and Hit Ok.

Choose Source Code Management tab from the top and Copy paste the ‘SSH’ repository URL

Click Add Jenkins next to credentials

Choose ‘Kind’ as SSH username and private key

Provide some meaningful description

Username: Should be either for GitHub/Bitbucket (, so just the username)

(Note even if you are connecting to Bitbucket repo, choose Git option in SCM)
Copy-paste the private key without any whitespaces and paste it under ‘Private Key’ and 

Hit ‘Add’


Browse to ‘Build Triggers’ tab at the top and Choose Poll SCM


Under ‘Schedule’ type this
H/15 * * * * – which means poll every 15 minutes

(Feel free to read through the help options by clicking the ? Icon for help

Now click the Post Build Actions > ‘Publish artifacts to S3 Bucket’

Type a meaningful name to the S3 Profile

Source as */

Destination bucket as <name of S3 Bucket>

Storage Class as Standard

Bucket Region as <Region your bucket is deployed>

Click Apply and Save.


Now you can try a sample commit from your repo and see how Jenkins, starts the build and deploys the codebase to S3 bucket at AWS


Browse through the public ip <public-ip>:8080 to see your webpage come to life.


Some points to keep in mind:

  • Don’t choose Bitbucket Server plugin for connecting to bitbucket repo, somehow it doesn’t work
  • You can always choose Add Jenkins ->under Credentials-> and choose ‘Kind’ as ‘Username and password’: This would mean you wish to connect using the credentials of your repo (bitbucket/Github)
  • Please leave a comment if you have any questions




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.