Category: English


In this tutorial, I'll be guiding you how to store your static HTML files on Bitbucket private repo and publish them on Amazon S3. You will be able to deploy your changes with git push and the files will be automatically deployed to S3.

We have three parties: AWS S3,, Bitbucket. is a deployment service with 1 repository access in the free plan. When you git push to your bitbucket git repository, a webhook informs to pull the content and publish it to S3. has read access to git repository and read/write access to S3.

Let's start building. Instructions might be missing since gives only 1 repository and user interfaces change once you create your repository. So I could not test a second one to give you more precise instructions.

We will use for demonstration. You may use your domain with www in front as well.

AWS S3 Setup

  • Create a new s3 bucket on AWS:
  • Create a new user mysitecom with IAM credentials. Download
  • Grant access to S3 repo
  • At bucket properties, Edit bucket policy, Paste this:

        "Version": "2012-10-17",
        "Statement": [
            "Sid": "PublicReadGetObject",
            "Effct": "Allow",
            "Pricipal": "*",
            "Action": "s3:GetObject",
            "Resource": "*"
  • In the Static Website Hosting section of the properties, choose "Enable website hosting".

  • Set Index document: index.html
  • For using your custom domain, follow this link.

Bitbucket Setup

  • Create a new repo on bitbucket:
  • git clone the repo to your local and push your initial commit: index.html. Setup

  • Integrations->Amazon->Connect->Account Name, Access Key, Secret Key, Region
  • Repositories->Connect a repository->Generic/custom git repository.
  • Use address:
  • Choose master branch, and do configurations.
  • Repositories -> -> General -> Public Key for Submodules -> Copy the public key or there should be a download link, download the file and copy the content of the downloaded file (deployment key).
  • Repositories -> -> Settings -> Web Hooks & Badges -> Copy the given URL (hook URL)

Bitbucket Integration

  • Hooks section -> Select A Hook -> POST -> Add Hook and Paste the given Hook URL.
  • Deployment Keys -> Add Key -> Paste deployment key from, give a label:


  • Now you should be able to see your S3 site on

Potential Problems

As of now, deployment performs copy operation on AWS S3, not a sync operation. So if you deleted any files locally, they won't be deleted on the remote (S3). You may have to delete it manually.

Share: FacebookGoogle+Email

comments powered by Disqus