This file describes how the Amplify project was set up from scratch. This is saved for debugging purposes in the future, you don't need to follow these instructions if you follow those in the README.
Still a WIP, some old instructions are left behind.
-
Prereq: Install the aws amplify CLI
-
Run
amplify configure
-
Run
amplify add auth
- Default configuration
- No additional changes
-
Run
amplify add api
- GraphQL
- Default Authorization Type: IAM
- Yes, I want to make some additional changes
- Configure Additional Auth types?
y
- Hit 'Space' on Amazon Cognito User Pool to select it, then hit 'enter'
- Configure conflict detection?
N
- Do you have an annotated GraphQL Schema?
No
- Do you want a guided schema creation?
Yes
- What best describes:
Single object with fields
- Edit Schema now?
Yes
- Then, paste the contents of the
schema.graphql
found in this repo. Only include thePost
object though; don't add theCreatePostInput
or theBatchAddPost
. - Back to CLI. hit enter
-
Run
amplify update auth
- What do you want to do?
Walkthrough all the auth configurations
- Select the authn/authz services:
User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per user Storage ...)
- Allow unauthenticated logins?
Yes
- 3rd party authn providers?
No
- Add User Pool Groups?
No
- Admin queries API?
No
- MFA?
OFF
- Email based user registration / forgot password:
Enabled
- Specify email stuff: hit enter on all of them
- Override pw policy?
N
- Refresh token expiration:
30
- Specify user attributes they can read/write:
N
- Enable any of the following? None, hit 'enter'
- Oauth?
N
- Lambda Triggers for Cognito?
N
- What do you want to do?
-
Run
amplify add function
- Choose a friendly name
- Choose the official name
NodeJS
Lambda Trigger
DynamoDB
Use API category graphql model
- Other resources?
N
- Recurring?
N
- Edit Now?
Y
-> Paste the code found inamplify/backend/functions/editPostLambda/src/index.js
. Don't include the DO NOT EDIT stuff. Make sure to update the name of the table in the variablePOSTS_TABLE_NAME
with your own DynamoDB table ID.
-
Run
amplify push
- Generate code?
Y
Typescript
- Hit enter
- Generate/update all?
Y
- Maximum statement depth: 2
- File name: hit enter
- Generate code?
-
Give the
addLinkTitle
lambda trigger function permission to edit the DynamoDB table. This way, the lambda function can automatically add the title to newly saved links.- Go to your AWS Amplify console at
http://console.aws.amazon.com/amplify
. - Click on your project name, in this case
links
. - Click on
Backend environments
. Then click on the one environment we have so far, in this casedev
(yes, you're testing in prod / users are in dev) - Select the tab
Functions
. With theaddLinkTitle
selected, click onView in Lambda
. - Select the
Permissions
tab. - Click the hyperlinked role name under "Role name" to go to the Lambda's Execution Role (which determines its security access) in IAM.
- In the drop down menu named
Resource summary
, you'll see 2 options: Amazon CloudWatch logs and Amazon DynamoDB. Edit the permissions to allow read/write access to both of these resources.
- Go to your AWS Amplify console at