hey all! I’ve got an architectural conundrum that ...
# random
s
hey all! I’ve got an architectural conundrum that i’m trying to figure out, and I’m pretty stuck. here’s the deal: our setup is pretty typical: a primary AWS account running the production SST stack + front end, and multiple AWS sub-accounts for developers with their own SST stacks (but no front end). when someone opens a PR for the front end, AWS Amplify Console deploys a preview branch (e.g.
<http://pr-131.reelcrafter.com|pr-131.reelcrafter.com>
) so we can look at it & test things out. the problem is, ALL front end deployment happens in the production account, and is tied to the GitHub repo. I’m trying to figure out a way for a dev to open a PR, and somehow point that preview instance of the front end to their SST dev stack in their AWS account
since each dev’s API URL, bucket name, etc. are not likely to change, it’s not the end of the world if I have to put those into an SSM parameter in the primary account as a JSON object. so then there’d just have to be some way for Amplify Console to know which user opened the PR. https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#amplify-console-environment-variables maybe each dev uses a branch format like
myusername/feature
.. then I can extract the username & grab the SSM parameter via https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html#environment-secrets
o
We use the reactstaticsite construct to deploy our UIs through SST that point to the right backend. Our prod account delegates a subdomain to a hosted zone in the dev account(we have one dev account), and the construct adds the appropriate DNS entries for the stage (developer/pr/upstream). Not sure if that's useful since you use amplify console, I think it'd be difficult to have the UI and backend in sync with two different CI processes. Any way to have SST kick off an amplify build with parameters instead of having it kicked off directly from a pr.
a
We did the same as @Omi Chowdhury.
It’s all done really easily and we don’t need to manage any DNS or anything manually.
s
thanks, guys. I wonder if the ReactStaticSite works with Vue..? I’m hesitant to leave Amplify Console, it makes everything super easy when it comes to automatic preview deploys 🙂