#More readable naming on resources

5 messages · Page 1 of 1 (latest)

jovial saddle
#

Is there a way to have the resources generated when using Amplify to be named something more readable?
Example, my Cognito resourcees is named something like amplifyAuthUserPool<some-id>.

Also it would be nice if I could replace resources. I had a user pool with users and for some reason Amplify decided to create a new user pool. So now I'll have to recreate all users.

Bonus would be if I could somehow specify the whole stack as IaC in the same (or separate) repo.

unkempt roost
#

Hey you override the name of the resource on the backend.ts by overriding the resource.
backend.auth.resources.cfnResources.cfnUserPool
but do note when deploying a new branch with a name override CloudFormation will try to create a new resource with the same name and fail as the resource with name already exists.
if you would like to re-use an Cognito resource across branches i would suggest referencing the manually created resources. But do note you cannot override/modify a referenced resource in the backend and will need to be managed by you.
https://docs.amplify.aws/react/build-a-backend/auth/use-existing-cognito-resources/#use-auth-resources-with-an-amplify-backend

jovial saddle
unkempt roost
#

Hey, this would depends on your use case and workflow you want to create.
for your resource name you could use the env variable with the branch name as the unique identifier in the name of the resource. such that it will not conflict with your existing resource. This way you would have new resource created in your testing env without accidentally modifying prod data.
But if your use case involves say you already have a existing user pool from a different app and you would like to import the same user base and configuration. referencing the auth resource would help with.

jovial saddle
#

Im really new at Amplify and aws still so Im not sure how this all works.

Using branch name sounds smart.
Will that work for sandboxes as well? Do they use the same branch name?

Referencing the same auth for all branches would be nice to always have user access in all different environments.
Annoying to always have to create a new user and set all the permissions