Skip to content

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.

License

aws-amplify/amplify-category-api

AWS Amplify

Discord Chat build:started

Reporting Bugs/Feature Requests

Open Bugs Feature Requests Enhancements Closed Issues

AWS Amplify API Category

The AWS Amplify CLI is a toolchain which includes a robust feature set for simplifying mobile and web application development. The CLI uses AWS CloudFormation and nested stacks to allow you to add or modify configurations locally before you push them for execution in your account.

This repo manages the API category within Amplify CLI. The Category is responsible for managing graphql build and transformation processes, generating resources to deploy into your cloud stack in order to compute and store data for your graphql and REST endpoints, and providing inputs to codegen processes for use later in your end application.

Install the CLI

  • Requires Node.js® version 18 or later

Install and configure the Amplify CLI as follows:

$ npm install -g @aws-amplify/cli
$ amplify configure

Note: If you're having permission issues on your system installing the CLI, please try the following command:

$ sudo npm install -g @aws-amplify/cli --unsafe-perm=true
$ amplify configure

Category specific commands:

The following table lists the current set of commands supported by the Amplify API Category Plugin.

Command Description
amplify api add Takes you through steps in the CLI to add an API resource to your backend.
amplify api add-graphql-datasource Takes you through the steps in the CLI to import an already existing Aurora Serverless data source to an existing GraphQL API resource.
amplify api update Takes you through steps in the CLI to update an API resource.
amplify api gql-compile Compiles your GraphQL schema and generates a corresponding cloudformation template.
amplify api push Provisions only API cloud resources with the latest local developments.
amplify api remove Removes an API resource from your local backend. The resource is removed from the cloud on the next push command.

Tutorials

Developing

To set up your local development environment, go to Local Environment Setup.

To test your category, do the following:

cd <your-test-front-end-project>
amplify-dev init
amplify-dev <your-category> <subcommand>

Before pushing code or sending a pull request, do the following:

  • At the command line, run yarn lint at the top-level directory. This invokes eslint to check for lint errors in all of our packages.
  • You can use yarn lint to find some of the lint errors. To attempt fix them, go to the package that has errors and run yarn lint-fix
  • If there are any remaining lint errors, resolve them manually. Linting your code is a best practice that ensures good code quality so it's important that you don't skip this step.

Contributing

We are thankful for any contributions from the community. Look at our Contribution Guidelines.