A Noob's Quest

A Head of Engineering Finally Learning Tech.

Static website in S3 with Password Protection

2022-02-11 DevOps jsfan
Coming from Apache or NginX, you would think of adding password protection to a static website as a trivial problem. All you do is generate a file containing usernames and password hashes and then reference it in the web server configuration or (in Apache) possible a .htaccess file. Unfortunately, adding password protection to a static website hosted in AWS S3 behind CloudFront isn’t quite as simple. You will have to use a Lambda which authenticates and passes through the request or rejects it as unauthorised. Continue reading