CodeDeploy to S3

Today AWS has announced as a new feature the ability to target S3 in the deployment stage of CodePipeline. The announcement is here, and the documentation contains a tutorial available here.

Using your CodeBuild/CodePipeline approach, you should now be able to choose S3 as the deployment provider in the deployment stage rather than performing the sync in your build script. To configure the phase, you provide an S3 bucket name, specify whether to extract the contents of the artifact zip, and if so provide an optional path for the extraction. This should allow you to deploy your content directly to the root of a bucket by omitting the path.


I was dealing with similar issue and as far as I was able to find out, there is no service which is suitable for deploying app to S3.

AWS CodeDeploy is indeed for deploying code running as server.

My solution was to use CodePipeline with three stages:

  1. Source which takes source code from AWS CodeCommit
  2. Build with AWS CodeBuild
  3. Custom lambda function which after successful build takes artifact from S3 artifact storage, unzip it and copies files to my S3 website host.

enter image description here

I used this AWS lambda function from SeamusJ https://github.com/SeamusJ/deploy-build-to-s3

Several changes had to be made, I used node-unzip-2 instead of unzip-stream for unziping artifict from s3.

Also I had to change ACLs in website.ts file


Uploading from CodeBuild is currently the best solution available.

There's some suggestions on how to orchestrate this deployment via CodePipeline in this answer.