AWS AppSync Microservices Access Layer Reference Architecture
The AWS AppSync Serverless GraphQL microservice-access-layer reference architecture showcases AWS AppSync as a single interface to access and combine data from multiple microservices running in different environments :
The sample app is based on a very simple webstore where users can login, and interact with different services.
AWS Account with appropriate permissions to create the related resources
AWS CLI with output configured as JSON (pip install awscli --upgrade --user)
If using Windows, you'll need the Windows Subsystem for Linux (WSL)
Create new Amazon Elastic Container Registry (Amazon ECR) (in the same region where amplify app will be deployed) and push payment application to container registry.
git clone [email protected]:<username>/appsync-refarch-microserviceaccesslayer.git
cd appsync-refarch-microserviceaccesslayer/paymentapp
REPO=$(aws ecr create-repository --repository-name paymentapp --image-tag-mutability IMMUTABLE --output text --query repository.repositoryUri)
echo '# get-login'
$(aws ecr get-login --no-include-email)
echo '# repo'
echo ${REPO}
echo '# build docker image'
docker build . -t python/paymentapp:v1
echo '# tag this app as version 1'
docker tag python/paymentapp:v1 ${REPO}:v1
echo '# docker push'
docker push ${REPO}:v1
Note: If you use any other branch than master, make sure to update resource path in resolver mapping template ./amplify/backend/api/StoreApi/resolvers/Query.getUserInfo.req.vtl
. You can read more about configuring HTTP Resolver for AWS AppSync here
(npm install -g @aws-amplify/cli)
cd appsync-refarch-microserviceaccesslayer && npm install
amplify pull --appId <app-id-from-console> --envName <env-name>
? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use default
Amplify AppID found: xxxxxx1234sd. Amplify App name is: aws-appsync-refarch-microservices}
Backend environment master found in Amplify Console app: aws-appsync-refarch-microservices
? Choose your default editor: Visual Studio Code
? Choose the type of app that you're building javascript
Please tell us about your project
? What javascript framework are you using react
? Source Directory Path: src
? Distribution Directory Path: build
? Build Command: npm run-script build
? Start Command: npm run-script start
? Do you plan on modifying this backend? Yes
Successfully pulled backend environment master from the cloud.
Run 'amplify pull' to sync upstream changes.
npm start
To clean up the project, you can simply use;
amplify delete