API deployment

Once your model is exported, you've implemented a Predictor, and you've configured your API, you're ready to deploy!

cortex deploy

The cortex deploy command collects your configuration and source code and deploys your API on your cluster:

$ cortex deploy
creating my-api (RealtimeAPI)

APIs are declarative, so to update your API, you can modify your source code and/or configuration and run cortex deploy again.

cortex get

The cortex get command displays the status of your APIs, and cortex get <api_name> shows additional information about a specific API.

$ cortex get my-api
status up-to-date requested last update avg request 2XX
live 1 1 1m - -
endpoint: http://***.amazonaws.com/text-generator

Appending the --watch flag will re-run the cortex get command every 2 seconds.

cortex logs

You can stream logs from your API using the cortex logs command:

$ cortex logs my-api

Making a prediction

You can use curl to test your prediction service, for example:

$ curl http://***.amazonaws.com/my-api \
-X POST -H "Content-Type: application/json" \
-d '{"key": "value"}'

cortex delete

Use the cortex delete command to delete your API:

$ cortex delete my-api
deleting my-api

Additional resources

  • Tutorial provides a step-by-step walkthrough of deploying a text generation API

  • CLI documentation lists all CLI commands

  • Examples demonstrate how to deploy models from common ML libraries