To Connect App with DynamoDB Database, we need to setup & configure AppSync API. Refer below steps to set up AppSync API:
STEP 1: #
- Sign in to the AWS Console, Navigate/Search for AppSync
- Click on “AWS AppSync“
STEP 2: #
- Click on “APIs” from the left menu
- Select the correct “Region” where you already had setup the Authentication Pool
- Click “Create API” button to Create a new API.
STEP 3: #
- Select “GraphQL APIs” as the API type
- Select “Design from scratch” as Data source.
Click Next
STEP 4: #
Enter “DBConnectAPI” as the API name and hit Next
STEP 5: #
Select “Create GraphQL resources later” and click Next.
STEP 6: #
Review & Click Create API
STEP 7: #
- From the left menu, Click the newly created “DBconnectAPI”
- Navigate to Settings tab
- Setup Default authorization mode
- Select “Amazon Cognito User Pool” under API-level
- Select the “AWS Region” where you already have set up the Authentication Pool
- Select “CustomAuthenticationPool” from the User pool list.
STEP 8: #
Click on “New” button to add an Additional authorization providers.
Select “AWS Identity and Access management (IAM)“from the list & hit Submit
STEP 9: #
Click “Save” to save the changes done in Authorization mode
STEP 10: #
👏 Congratulations! AppSync API is now created.
- Navigate to “AppSync” section from the AWS Console
- Click on “APIs” from the left menu
- Make sure you have the correct “AWS Region” selected
- The newly created “DBConnectAPI” will be shown here
Copy AWS_APPSYNC_API_NAME, AWS_GRAPHQL_API_ENDPOINT and AWS_APPSYNC_API_ID as shown below and use it in the app setup wherever required.
STEP 11: #
Next, we have to Configure the AppSync API that was recently created.