1.0.0 • Published 5 years ago
@architect/macro-storage-public v1.0.0
@architect/macro-storage-public
Architect serverless framework macro that defines any number of arbitrary public S3 buckets for your application
@architect/macro-storage-public provisions public S3 buckets for your application. If you need to provision private S3 buckets, check out @architect/macro-storage-private.
Installation
Run:
npm i @architect/macro-storage-publicThen add the following line to the
@macrospragma in your Architect project manifest (usually.arc):
Note, no
@in the macro name!
@macros
architect/macro-storage-public- Add a new
@storage-publicpragma
Define any number of S3 bucket names within @storage-public; the following characters are allowed: [a-zA-Z0-9_-]
@storage-public
public-data
sharedinfoAccessing your bucket names
- Because CloudFormation provisions these buckets, your bucket name will be reformatted and provided a GUID by AWS
- Thus, to deterministically access your bucket name, your Lambdas will be assigned a
ARC_STORAGE_PUBLIC_<bucketname>env var (with any dashes converted to underscores)- Example: your app is named
myapp, and your bucket is namedpublic-datain your.arcfile - Your Lambda(s) would read the
ARC_STORAGE_PUBLIC_PUBLIC_DATAenv var (which would be assigned a value similar tomyappstaging-publicdatabucket-1f8394rh4qtvb)
- Example: your app is named