Docs Navigation

Deploying to Amazon S3

Amazon Simple Storage Service (Amazon S3) is a cloud storage service, which you can use to store and retrieve any amount of data (photos, videos, documents etc.) at any time, from anywhere on the web.

You can also easily use Amazon S3 buckets to host a website which uses client-side technologies (such as HTML, CSS, and JavaScript) and does not require server-side technologies (such as PHP or Ruby on Rails).

This guide will show you how to easily set up a static website on Amazon S3 using Semaphore. If this is your first time deploying a static website to Amazon S3, the following steps will guide you through some basic concepts.


Before you begin, you will need to: * Create an AWS account * Connect your GitHub or Bitbucket project to Semaphore.

Retrieving Security Credentials

Before you begin, you will need to retrieve your AWS security credentials, which you will use later on to provide Semaphore with access to your application. Go to your AWS console and select "Security credentials" in the upper right corner below your name.

AWS Console

In the left navigation bar, click the "Users" option and create a new user. The user you are about to create serves as a placeholder for a set of permissions you will delegate to Semaphore in order to set up your website.

Users Nav Bar

Choose a name for your user, download the credentials and store them somewhere safe, because you will need those in one of the following steps.

User Name

Save Credentials

After you have created the user, you have to assign him the permissions. In the users list, click the username to see its page. You can read more about assigning managed policies to users or groups here. By clicking the "Attach policy" button under "Permissions", you will see a list of predefined AWS policies.


If you choose AmazonS3FullAccess, your setup will work, but this is usually not recommended. By following the standard security advice of granting the least possible privilege, you should grant only the permission required to perform this task. You can use the example policy provided at the end of this article.

Setting Up the Website

Amazon S3 stores data as objects within buckets. An Amazon S3 bucket is a container for objects and an object consists of a file and optionally any metadata that describes that file. To use it for static website hosting, you basically need to create a bucket, upload your files to it and configure the bucket to act as a website. Semaphore provides an easy way to that. Go to Semaphore and add new server for deployment to your project. As an option choose Amazon S3 cloud storage.

Set Up Deployment

Choosing the Deployment Strategy

In this tutorial we will use Automatic deployment strategy. This means that every time you commit a change to your repository, your website will be automatically deployed.

Choose Strategy

Next, choose which branch contains the files you want to deploy. This is the branch which will be automatically synced in the future.

Choose Branch

Entering the AWS credentials and selecting region

Semaphore needs the AWS credentials to retrieve a list of your existing buckets or create a new one and perform the deployment. Paste the corresponding values you have saved in the "Retrieving Security Credentials" section.

To reduce latency, minimize costs, or address regulatory requirements, you can choose a region in the select box that is closer to the users for your website.

Enter Credentials

Adding Build Commands

The files created during the build phase on Semaphore won't be available during deployment, so if you need to generate some files before deploying them, this is where you should enter your build commands.

In case you don't want to upload your entire repository, just type in the name of the directory that you want to upload. In our example, the build commands will generate a directory named build which will contain the static files and that is exactly the one we want to upload. If your entire repository is a static website, you can leave both the directory and command fields empty.

Choose Commands

Choosing a Bucket

The S3 Index document is the name of the file which will be your website's home page. S3 will look for this file within the directory you specified in the previous step (in our case, it will look in the build directory). This file is usually called index.html.

Next, you choose which bucket will contain your files. If you already have buckets previously created, you can choose one of them from the select box. Otherwise, you can create a new one by clicking the Create new S3 bucket link at the bottom of the page. A text field will appear in which you will enter the name of your new bucket.

Create Bucket

The bucket name you choose must be unique across all existing bucket names in Amazon S3. You can read more about bucket naming rules in Amazon S3 documentation. If you name your bucket it will be accessible through the URL that looks something like this: If you plan to use Amazon S3 static website hosting with a custom domain such as it is recommended that you use it to name your bucket. If you want to learn how to set up a custom domain, you can find more information in this walkthrough. You can still use the predefined Amazon S3 URL if a custom domain is not important to you (e.g. you just want to show the client how the website will look like). After you have created the bucket, it will appear in the select box and you can proceed to the next step.

Choose Bucket

Naming your server

The last thing you need to do is name your server and create it. Also, paste your website URL in the "Server URL" field to make it easily accessible through Semaphore.

Name Your Server

Uploading your Files

In the last step, click "Deploy" to start copying files from your repository to Amazon S3.

Click Deploy

When all commands have finished executing, you can click the link to your website to see your homepage.


Congratulations! You have successfully configured your website to be automatically updated with Semaphore.

Example AWS IAM policy

This example shows a policy which provides Semaphore with access to manage your S3 buckets in the process of setting up your deployment. This section of AWS documentation explains how to create a custom policy. You can copy the policy shown below.

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "Stmt1461232964000",
            "Effect": "Allow",
            "Action": [
            "Resource": [

Semaphore Docs are open source — Edit on GitHub


Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2017 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.