Deploy prebuilt site to Cloudflare Pages from s3 bucket

I want to deploy a prebuilt static site to Cloudflare Pages. I have an CMS that builds a static site for me and I can have it copy its output to an s3 bucket and trigger a deploy hook. So I would want an option to have Cloudflare pages copy the site from s3 to deploy.

I think the easiest way to accomplish this would be to:

  1. Make connecting to a git repo optional (technically not required as I could just connect an empty repo but it won’t be needed for this)
  2. Include the AWS CLI as a preinstalled tool

Then I could:

  1. Setup my AWS credentials as environment variables
  2. Trigger a build using a deploy hook
  3. Set my build command to: “aws s3 sync s3://(bucket-name) output”
  4. Use “output” as the build output directory.

Technically I should be able to replicate this with what is available today but that will require me to

  1. Write (or find a prewritten) sync tool in a supported language
  2. Link to a git repo with the sync tool
  3. Set the build command to run the sync tool

I just feel the process would be much nicer if you included the AWS CLI and allowed me to not have to write or find my own syncing tool.

This should already be possible! Just create a GitHub repo with the aws-cli Linux binary and set the build command to chmod +x ./aws-cli && ./aws-cli s3 sync s3://(bucket-name) output :slightly_smiling_face:

1 Like

It sounds like you just want to have Cloudflare proxy requests to your Origin server running on S3, and not use Pages for anything other than free static site hosting. Or have I misunderstood?

s3 isn’t an origin, it’s just a temporary storage between my cms and pages.
Unless there’s a better way to move the files into pages because there is no build process, at least not that pages will have to do, because I’m not sure I can get my cms to run in a pages build because it requires PHP8 and it’s licensed and does some sort of licensing check to verify its running a licensed copy. But since it’s already installed on my own server for users to interact with that server is handling the build and I just need to pass off the built version directly to pages.

I wouldn’t have guessed I could add execute permissions but since its just a shortlived environment I guess maybe they didn’t bother to lock it down.

You’re just an unprivileged user in a Docker container :slightly_smiling_face: