This project is the AmpStack API
, which is a Serverless Framework based Serverless ExpressJS REST API implemented with AWS API Gateway and Lambda. The front end is implemented in AmpStack UI. See the other READMEs for more details.
These are contained in the .env.sample
, which should be renamed to .env
and populated with the correct environment values, such as the REST API endpoint.
For multi-stage environments (Eg. dev/prod), name the .emv
as .env.<stage>
, such as .env.prod
, and the serverless.yml
will pickup the correct settings with you specify, eg. sls deploy --env dev
.
Make sure to associate the correct Amplify Environment Cognito ARN with the correct stage, and also update the VITE_EXPRESS_ENDPOINT in the Amplify UI Environment Variables correctly for the associated backend.
If you only have a single front-end environment, you will only need the COGNITO_ARN0
specified.
Adjust the env. file with the correct Amplify Cognito User Pool ARN:
COGNITO_ARN0=arn:aws:cognito-idp:us-east-1:XXXXXXXXXX
ALLOW_ORIGIN=*
Adjust the serverless.yml
file, commenting out the extra COGNITO(n)
lines:
ProviderARNs:
- ${env:COGNITO_ARN0}
# - ${env:COGNITO_ARN1}
# ${env:COGNITO_ARN2}
# ${env:COGNITO_ARN3}
For cases where you have several environments all wishing to make use of the same backend, multiple Cognito ARNS must be specified. This seems to be because a single Amplify Front-End can't share the same Cognito User Pool with a different redirect URL. At the present time the solution is to have the API Gateway custom Authorizer use multiple Cognito User Pools.
Adjust the env. file with the correct Amplify Cognito User Pool ARNs:
COGNITO_ARN0=arn:aws:cognito-idp:us-east-1:XXXXXXXXXX
COGNIT1_ARN0=arn:aws:cognito-idp:us-east-1:SOMEOTHERPOOL
ALLOW_ORIGIN=*
Adjust the serverless.yml
file, commenting out the extra COGNITO(n)
lines, but also ensuring the correct lines are uncommented:
ProviderARNs:
- ${env:COGNITO_ARN0}
- ${env:COGNITO_ARN1}
# ${env:COGNITO_ARN2}
# ${env:COGNITO_ARN3}
Adjust ALLOW_ORIGIN to suit your front-end environment. S
It is handy to use the local DynamoDB for debugging when developing.
sls dynamodb install
Other sls
related dynamodb
plugin commands are available with sls help