Deploying Savings Pot Microservices on AWS

This section explains how to deploy the Party microservice on the AWS cloud. To do so, you need to perform the following tasks:

Deployment Artefacts

Savings Pot Microservice for AWS deployment is available as single release bundle. For example, ms-savingspot-package-aws-<release_number>.zip. It consists of the ms-savingspot-package-aws-<release_number>.jar file and AWS script files.

  1. The install-aws.sh script is used to deploy the Savings Pot microservice in the Standalone mode.

  2. Use the destroy-aws.sh script to undeploy and delete the resources.  The Swagger JSON document will be available in the location:  /ms-savingspot-package-aws-<release no>.jar/api.

Deployment of Microservices on AWS

Prerequisite

  • AWS CLI and Python 2.7.x must be installed prior to the deployment and an active connection string of Mongo Atlas cluster is required.
    NOTE:
    • Mongo Atlas Connection string should be obtained for Java driver version 3.4.
    • Download the Mongo Shell from Mongo Atlas under the tab named Connect with Mongo Shell by clicking Connect.
    • Add the shell bin path to your system path and restart the system, if required. For example, C:\MSDownloads\mongodb-win32-x86_64-windows-4.4.0\bin.

To deploy the Savings Pot microsevice on AWS, follow these steps.

  1. Obtain the generated zip file (from target folder) in the installation directory and unzip it.
  2. In AWS command line, navigate to the installation directory.
  3. Modify the region information in the install-aws.sh script specific to your installation

    Examples,

    • --region us-west-2
    • --event-source-arn arn:aws:kinesis:us-west-2
    • --uri arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2
  4. Similarly, modify the following parameters in install-aws.sh and destroy-aws.sh accordingly:

    • MONGODB_CONNECTIONSTR
    • MONGOSHELL_CONNECTIONSTR
    • MONGODB_DBNAME

  5. To deploy the microservice, execute install-aws.sh shell script to create the resources.
  6. Post-deployment sign into AWS portal and verify the lambda and API gateways.
  7. Lambda functions

    API Gateway

  8. To obtain the API key for all the endpoints in AWS, navigate to API key section under the Amazon API gateway, select the corresponding API key, and click show. The API key has to be a part of header (x-api-key) in all the requests.
  9. The Base path of the API gateway URL follows the below structure
    • Base URL. https://<REST-API-ID>.execute-api.<LOCATION>.amazonaws.com/<DEPLOYMENT_ID>

      For example, https://0mnkccy9mh.execute-api.eu-west-2.amazonaws.com/ms-savingspot-api

    • The Resource path of the endpoint can be found in the APIs.
    • A sample endpoint of marketing catalog can be https://0mnkccy9mh.execute-api.eu-west-2.amazonaws.com/ms-savingspot-api/api/v1.0.0//holdings/savingPots.
    • Rest API ID can be obtained from Amazon API Gateway.

Location and deployment ID must be replaced with the appropriate values provided in the script during deployment.

Undeployment

To undeploy the Savings Pot microservice from the AWS cloud, follow these steps.

  1. Modify the parameter named MONGOSHELL_CONNECTIONSTR in the destroy-aws.sh file as indicated earlier in the deployment steps.
  2. Execute the destroy-aws.sh file.

NOTE: The database user credentials must have the admin access.


Bookmark Name Actions
Feedback
x