aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
459 stars 116 forks source link

Turn on password for PR previews #3691

Open afern247 opened 1 year ago

afern247 commented 1 year ago

I have turn on the password on amplify hosting for my dev environment/url, but when a new PR gets created that PR doesn't have a password and I can't apply it globally because then prod would also be protected with password, how can I restrict the access for PRs as well?

image

hbuchel commented 1 year ago

Hi @afern247 Transferring to Amplify Hosting repo for them to take a look.

Jay2113 commented 1 year ago

Hi @afern247 👋 , thanks for raising this!

You can enable access control or password protection on a per branch level by turning off the option to apply a global password.

To apply a username and password to an individual branch, turn off Apply a global password. For the branch that you want to set a unique username and password for, choose Restricted-password required for Access setting and enter a username and password.

Documentation: https://docs.aws.amazon.com/amplify/latest/userguide/access-control.html

afern247 commented 1 year ago

Hi @Jay2113 , please check my question again above:

I can't apply it globally because then prod would also be protected with password, how can I restrict the access for PRs as well?

This is for Amplify Hosting preview on feature branches. Is there a way to apply globally and override only 1 (the main prod branch), if not what do you recommend in this case?

tobigumo commented 1 year ago

Hi @afern247

Your question probably relates to the following feature request. [Feature request] Support default password protection for all new branches #280

There is no direct feature as you are asking for, but you can solve it in the following ways.

currently there isn't an easy way to do so. A workaround would be to have 2 Amplify Console apps connected to the same repo - first app is your production app. 2nd app has all your other branches and you can set a global password for all the connected branches. https://github.com/aws-amplify/amplify-hosting/issues/280#issuecomment-561871146

afern247 commented 1 year ago

That's not scalable, that involves maintaining 2 separate entities with the same level of architecture.

I'm looking for a solution for 1 app only.