Тёмный

How to restrict access to a static S3 site using HTTP Basic Auth? 

BiteSize Academy
Подписаться 4,7 тыс.
Просмотров 22 тыс.
50% 1

In this video we add basic auth to an s3 bucket containing a static website.
⚡️ Blog post: www.undefineda...
This way, the browser will display an authentication dialog and require a username and password to get access to the static site. This will protect the files on our s3 bucket and limit access to them.
We use a cloudfront distribution and a lambda edge function that checks the request being made and authenticates the user.
⭐️ Subscribe for more content: newsletter.und...
#basicauth #s3 #cloudfront

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 52   
@antopolskiy
@antopolskiy Год назад
I thought this would take me a week to figure out. You made it possible in 45 min. Thank you!
@loficatme
@loficatme Год назад
@BiteSize Academy That was excellent. only thing is that with the latest version of node (18) the default setting allows only this syntax `export const handler = async (event) => ` as opposed to exports.handler = async(event)
@beners
@beners 3 года назад
Really helpful walkthrough, thank you! Just a note that I had to wait a few hours after creating the bucket and spinning up Cloudfront for DNS to propagate when using the global url for my bucket as demonstrated in the tutorial
@saranyadec1952
@saranyadec1952 9 месяцев назад
Hi i m saranya. I have followed the steps you have expalined in the video. But still i was not login to the website it alsways asking for the credentials. How i can solve this??
@Dudarinho
@Dudarinho 6 месяцев назад
it seems that ui has changed now and there are more settings to do and permissions to add
@EmilieZawadzki
@EmilieZawadzki 5 месяцев назад
True
@rasthamka529
@rasthamka529 3 года назад
Is there a link to your code repo?
@kevinfundarek5294
@kevinfundarek5294 7 месяцев назад
Excellent work! Thank you for creating this.
@brianhenning6030
@brianhenning6030 2 года назад
Thank you for the information, your video is informative and concise, you cant ask for anything more.
@creativaassociates4011
@creativaassociates4011 3 года назад
Great video. How would I modify the code if I wanted to add an additional user and password?
@SirFelixCoin
@SirFelixCoin 6 месяцев назад
Thank you for doing this. Are you able to add multiple authentication credentials for every viewer?
@anujpandit8860
@anujpandit8860 2 года назад
Bite-Sized and perfect, thanks a lot!
@darshank
@darshank 2 года назад
It work as per the steps covered. I am trying to use AWS IAM or Azure AD as a authentication provider. Do you have any similar video for this?
@sternpen4429
@sternpen4429 3 года назад
It would have been helpful if you do video on CDN new UI.
@anesumugomba524
@anesumugomba524 2 года назад
yep. the new UI very different from the one in the video
@adriandixon2787
@adriandixon2787 2 года назад
Your content needs way more views. Instead of a popup auth, how can I tie the login creds to a form on the website that then sends the user to the locked page?
@EmilieZawadzki
@EmilieZawadzki 5 месяцев назад
After adding additionnal permissions, this authentication code through me a 503 error. It is weird that I could already reach the limit of lambda just after creation.
@nagautube1
@nagautube1 3 года назад
Nice content, thanks for the upload. Appreciated !!
@squidwurrd
@squidwurrd 2 года назад
Fantastic video!
@karnibedirian9405
@karnibedirian9405 2 года назад
Really helpful tutorial, and I get it working! Just a question/advice. When I have one tab open of my app running through CloudFront, it asks for username and password, following this tutorial. But when I open a second tab and run the app (keeping the first tab open), it does not ask for username password. My point is that the username and password is being cached somehow. Is there a way for this not to happen? So that everytime I open my app, asks me for username and password? T
@NhanNguyen_dra
@NhanNguyen_dra 2 года назад
hmmm, I get 502 ERROR => The request could not be satisfied. Any help?
@BigPapaMoe
@BigPapaMoe Год назад
If you are using js.18.x, start it with "export const handler = async (event) => " . For 14.x, use "exports.handler = async (event) => "
@memphis101a
@memphis101a 2 года назад
Dude, this is spot on
@memphis101a
@memphis101a 2 года назад
Btw the code is not posted on the description, i've checked the repos and is not there, I cannot get it to work :(
@EladRovek
@EladRovek Год назад
Hey, Small question, what is the expected cost for this soultion? because if i got it right every naviagtion in the website requires an invokation of the lambda, so if that's the case that's not a production solution that's a solution for private access to internal portals etc
@suryamouli24
@suryamouli24 2 года назад
It's a good video.pls can you make cognito authentication using edgelambda when user try to get object from S3 bucket via cloudfront distribution authentication page will came whether the users are in our userpool are authenticated or not
@NhanNguyen_dra
@NhanNguyen_dra 2 года назад
Cannot read property '0' of undefined Any one get this issues?
@captaineddy
@captaineddy 10 месяцев назад
How do you prevent bot spam with this setup?
@sadev0
@sadev0 3 года назад
It would be great if you start series of AWS cdk
@geekthegeek730
@geekthegeek730 3 года назад
super useful video🔥
@tranlu_salelee3416
@tranlu_salelee3416 2 года назад
Very very good.
@CenteredCircles
@CenteredCircles Год назад
I've used exact code but pop up is not showing up
@erzhan6121
@erzhan6121 2 года назад
How to make that authentication window appears every time when you refresh website?
@kashifejaz989
@kashifejaz989 Год назад
Can I use a custom login page for the same purpose?
@adamryason5509
@adamryason5509 3 года назад
I followed your steps multiple times, but once I upload the files to S3 and then create the CloudFront distribution, I get an error saying that Access Denied when attempting to go to the distribution link. Any ideas why this would be happening?
@BiteSizeAcademy
@BiteSizeAcademy 3 года назад
It takes some time until the CloudFront distribution is deployed, I think this could be the cause
@BigPapaMoe
@BigPapaMoe Год назад
If you are using js.18, start it with "export const handler = async (event) => " . For 14.x, use "exports.handler = async (event) => "
@anesumugomba524
@anesumugomba524 2 года назад
Please, I dont see a link in the description with the code
@FreddieMJFan
@FreddieMJFan 2 года назад
Hi! Is there a way using this configuration to have local s in the website not getting ‘Access Denied’ error? Thanks!
@umguy4
@umguy4 2 года назад
I cannot get CloudFront to invoke the basic-auth lambda. I set the trust on the execution role. Is anyone else have the same issue?
@vijaymkm
@vijaymkm 3 года назад
how can i use cognito user pool in lambda function?
@kevinsotomorales7382
@kevinsotomorales7382 3 года назад
I dont have a default root object, and I am getting access denied, how can I solve this?
@akshaypurabiya7636
@akshaypurabiya7636 2 года назад
hello there, What should I do if I want to *reload the page* instead of showing *no plants for you* plz reply
@utf8redactedcharacters
@utf8redactedcharacters 3 года назад
What about doing this with the new cloudfront functions?
@utf8redactedcharacters
@utf8redactedcharacters 3 года назад
I found the answer :) With Cloudfront's new functions feature: ``` function handler (event) { var request = event.request; var headers = request.headers; var authString = "Basic BASE64_OF_USERNAME:PASSWORD"; // If authorization header isn't present or doesn't match expected authString, deny the request if ( typeof headers['authorization'] == 'undefined' || headers['authorization'].value !== authString ) { return { statusCode: 401, statusDescription: 'Unauthorized', headers: { 'www-authenticate': { value: 'Basic' } }, }; } return request; }; ``` And then associate the function with the distribution EEEEZZZ
@anandvamsi5141
@anandvamsi5141 2 года назад
can you please share node js code
@sanketainchwar2595
@sanketainchwar2595 2 года назад
@BiteSize Academy I got an 503 request could not be satisfied error. Could anyone help me out?
@lennauxpaulohabal3022
@lennauxpaulohabal3022 2 года назад
also having this kind of error right now, have u figured it out how to solve it?
@padmanabh7031
@padmanabh7031 11 месяцев назад
@@lennauxpaulohabal3022 Also having the same error, any solutions ?
Далее
Тренд Котик по очереди
00:10
Просмотров 335 тыс.
Blue vs Green Emoji Eating Challenge
00:33
Просмотров 4,3 млн
How to use layers with Lambda functions?
8:54
Просмотров 40 тыс.
Тренд Котик по очереди
00:10
Просмотров 335 тыс.