This project implements the Orders
microservice that participates in the saga pattern with Amazon Elastic Kubernetes Service (EKS).
- Clone the repo.
git clone ${GIT_URL}/amazon-eks-saga-orchestration-orders
Skip this step, if instructions to build images were followed in the
eks-saga-aws
repository. Else, follow the steps below to build and push the image to Amazon ECR.
- Build the Docker image and push to Docker repository.
cd amazon-eks-saga-orchestration-orders/src
aws ecr get-login-password --region ${REGION_ID} | docker login --username AWS --password-stdin ${ACCOUNT_ID}.dkr.ecr.${REGION_ID}.amazonaws.com
IMAGE_URI=${ACCOUNT_ID}.dkr.ecr.${REGION_ID}.amazonaws.com/eks-saga/orders
docker build -t ${IMAGE_URI}:0.0.0 . && docker push ${IMAGE_URI}:0.0.0
- Create
ConfigMap
running the command below from theyaml
folder. ChangeAsia/Kolkata
to appropriate timezone value in thesed
command below. Then, run the following commands to create theConfigMap
.
cd amazon-eks-saga-orchestration-orders/yaml
RDS_DB_ID=eks-saga-db
DB_ENDPOINT=`aws rds describe-db-instances --db-instance-identifier ${RDS_DB_ID} --query 'DBInstances[0].Endpoint.Address' --output text`
sed -e 's#timeZone#Asia/Kolkata#g' \
-e 's/regionId/'"${REGION_ID}"'/g' \
-e 's/accountId/'"${ACCOUNT_ID}"'/g' \
-e 's/dbEndpoint/'"${DB_ENDPOINT}"'/g' \
cfgmap.yaml | kubectl -n eks-saga create -f -
- Run the following command to deploy Orders microservice.
sed -e 's/regionId/'"${REGION_ID}"'/g' \
-e 's/accountId/'"${ACCOUNT_ID}"'/g' \
orders.yaml | kubectl -n eks-saga create -f -
To clean up objects created by Orders microservice, run this command.
kubectl -n eks-saga delete deployment/eks-saga-orders svc/eks-saga-orders ing/eks-saga-orders configmap/eks-saga-orders
The Order microservice publishes to the following AWS SNS topics.
Topic | Message |
---|---|
eks-saga-order-success |
Published to when order is successfully raised. |
eks-saga-order-fail |
Published to if order is not raised. |