Build AWS AppSync API and API Client using Python

   Go back to the Task List

  « 6. Test AppSync Queries    8: Create Client »

7: Setup Development Environment

AWS Cloud9 is a cloud-based integrated development environment (IDE) from Amazon Web Services. In this task, you configure AWS Cloud9 environment with AWS SDK for Python Boto3 in order to program with AWS AppSync.

  1. Goto the AWS Cloud9 console and click on the Create environment button.

    Cloud9

  2. On the next screen, enter dojoenvironment as the name and click on the Next step button.

    Cloud9

  3. On the next screen, select Environment type as Create a new instance for environment (direct access). Select Instance type as t2.micro (1 GiB RAM + 1 vCPU). Select Ubuntu Server 18.04 LTS for the Platform. The development environment will have Ubuntu as the operating system. Keep rest of the fields with the default values and click on the Next step button.

    Cloud9

  4. On the next screen, click on the Create environment button.

  5. It will take couple of minutes to create the environment. Wait for the environment to be ready. Once it is ready, you can see bash console window in the bottom part of the screen. It provides console based access to the development machine.

  6. You will now configure the environment for the Python Boto3 SDK. Run the sudo apt-get update command in the console to update the environment.

    Cloud9

  7. Python3 is already installed in the environment. You can check it by running the command python3 –version bellow in the console.

    Cloud9

  8. AWS SDK for Python Boto3 is not installed in the environment. Run the sudo apt install python-boto3 command to install Boto3 package in the environment. When it asks for the confirmation; you type in Y and enter.

    Cloud9

  9. Finally run the command sudo pip install requests_aws4auth to install Amazon Web Services version 4 authentication module. This module is used for authentication with the API.

    Cloud9

  10. The Cloud9 environment is ready for the AWS AppSync programming with AWS SDK Boto3. Let’s build a client code which calls the AppSync API you created.