getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
912 stars 111 forks source link

Creating CDN for storage type #318

Open ArabAgile opened 1 year ago

ArabAgile commented 1 year ago

Greetings,

I am using storage construct to store Laravel storage files in. However, as these files needs to be publicly available (behind CDN), I can't see any option where CDN will be created for this purpose.

Is it a bug? Or I should create another bucket with another cdn?

mnapoli commented 1 year ago

There is indeed no "public storage" construct, see https://github.com/getlift/lift/discussions/201

I think it could make sense to create a new construct for that though.

anamaker commented 1 year ago

I created my construct like this

constructs:
    uploads:
        type: storage

However, uploads is where the application will store the uploaded files for example. These files are different than the static files /public/static/file.js which stored in another bucket. These files needs to be publicly available somehow. The user uploaded his "avatar.png", and this should be served over CloudFront as cdn.

But no cdn for storage construct! So the dirty way is to create it manually. Unless you have the best practice for this case.