Lambdas for jokes API, which is the back-end for jokes-ui.
The developer role is required to deploy this project.
To run locally, AWS CLI is required in order to assume a role with permission to update resources. Install AWS CLI with:
brew install awscli
If file ~/.aws/credentials does not exist, create it and add a default profile:
[default]
aws_access_key_id=<YOUR_ACCESS_KEY_ID>
aws_secret_access_key=<YOUR_SECRET_ACCESS_KEY>
region=us-east-2If necessary, generate a new access key ID and secret access key.
Add a developer profile to the same credentials file:
[developer]
role_arn=arn:aws:iam::<account number>:role/developer
source_profile=default
mfa_serial=<YOUR_MFA_ARN>
region=us-east-2If necessary, retrieve the ARN of the primary MFA device attached to the default profile:
aws iam list-mfa-devices --query 'MFADevices[].SerialNumber' --output textJest tests are run automatically on commit and push. If the test coverage threshold is not met, the push will fail. See jest.config.ts for coverage threshold.
Manually run tests with:
npm run testBoth Prettier and ESLint are executed on commit. Manually prettify and lint code with:
npm run lintWhen a pull request is merged into master, the lambda code is transpiled to commonjs, zipped, and then copied to S3. Afterwards, the infrastructure portion of the project is deployed, which picks up the new versions in S3 and updates each lambda.
In extreme cases, lambdas can be transpiled, zipped, and uploaded locally with:
npm run deploySee the template.yaml file for information on updating infrastructure.