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“
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_1-1024x252.png)
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.
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_2-1024x171.png)
STEP 3: #
- Select “GraphQL APIs” as the API type
- Select “Design from scratch” as Data source.
Click Next
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_3-1024x812.png)
STEP 4: #
Enter “DBConnectAPI” as the API name and hit Next
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_4-1024x661.png)
STEP 5: #
Select “Create GraphQL resources later” and click Next.
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_5-1024x424.png)
STEP 6: #
Review & Click Create API
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_6-1024x867.png)
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.
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_7-1024x486.png)
STEP 8: #
Click on “New” button to add an Additional authorization providers.
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_8-1024x352.png)
Select “AWS Identity and Access management (IAM)“from the list & hit Submit
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_9-1024x357.png)
STEP 9: #
Click “Save” to save the changes done in Authorization mode
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_10-1024x509.png)
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.
![](https://docs.tctech.in/wp-content/uploads/2024/01/aps_11-1-1024x435.png)
STEP 11: #
Next, we have to Configure the AppSync API that was recently created.