Static Assets

Simple storage service is the original serverless primitive

Architect projects support text and binary assets such as images, styles, and scripts. These assets are available directly from the root of an app on the same domain as HTTP functions.



🚜 Work Locally

Running arc sandbox mounts public/ at http://localhost:3333.

Some frontend JavaScript workflows involve a build step, in which case the public/ folder can be considered a staging area for build artifacts.

💡 Protip: Architect works with any module bundler like Browserify, Parcel or Webpack


🌾 Provision

Given the following .arc file:

@app
my-site

@static

Running arc deploy will setup create the following resources:

  • AWS::S3::Bucket

🛳 Deploy

  • arc deploy copies public/ to staging S3 bucket after running a full CloudFormation stack update
  • arc deploy production copies public/ to a production S3 bucket after running a full CloudFormation stack update
  • arc deploy static immediately copies public/ directly to S3
  • arc deploy static production immediately copies public/ directly to S3

You can change the static deployment folder in .arc:

@static
folder dist

⛳️ Protip: arc deploy static --delete will remove files from the bucket that are no longer locally present


🔎 Fingerprint

If you are behind @cdn you will want to enable file fingerprinting to ensure content is both cached and updates are immediately available:

@static
folder dist
fingerprint true

🙈 Ignore

You can instruct Architect to ignore files from your public/ directory with the ignore directive, like so:

@static
folder dist
fingerprint true
ignore
  zip
  tar

This works with a simple string search, so if you ignore foo, all filenames containing foo (or files with paths containing foo) will be ignored.

By default, Architect ignores .DS_Store, node_modules, and readme.md files