All Products
Search
Document Center

Platform For AI:Deploy a model as an online service

Last Updated:Jun 08, 2026

Use PAI-EAS to deploy trained models as online inference services with custom images, storage mounts, and flexible resource configurations.

Billing

This example uses public resources billed on a pay-as-you-go basis. Stop or delete the service when idle to avoid charges.

image

Prerequisites

  • A PAI workspace is created.

  • A trained model is ready for deployment.

  • (Optional) Application code is uploaded to Object Storage Service (OSS).

  • (Optional) A container image is available in Container Registry (ACR) or as a DSW image URL.

Deploy a model with EAS

Deploy a model as an online service using EAS provides a complete walkthrough.
  1. Log on to the PAI console. In the top navigation bar, select the region and workspace. In the left-side navigation pane, click Elastic Algorithm Service (EAS) > Deploy Service > Custom Deployment.

  2. Set Deployment Method to Image-based Deployment.

  3. Configure Image Configuration to specify the runtime environment. Select an Alibaba Cloud image, a custom image, or an image URL.

    If the model was developed in DSW, select Image Address and copy the image URL from DSW.

    image

    Alternatively, push the image to ACR using Create a DSW instance image.

  4. In the Mount storage section, upload your application code to OSS and configure the mount path.

    image

    The following example shows a simple test application uploaded to the preceding OSS path.

    Example application code: web.py

    from bottle import Bottle, run
    
    # Create Bottle instance
    app = Bottle()
    
    # Define route that returns "Hello, World!"
    @app.route('/hello', method=['GET', 'POST'])
    def hello():
        # In production, replace this with parameter parsing and model invocation
    
        return 'Hello, World!'
    
    # Run server
    if __name__ == '__main__':
        run(app, host='0.0.0.0', port=9000)
    
  5. In Command, enter the command to start the application.

    image

  6. In Port Number, enter 9000 to match the port defined in web.py.

  7. In Third-party Library Settings, add libraries not included in the image. For example:

    image

  8. For Resource Type, select Public Resources. For instance type, select ecs.gn7i-c16g1.4xlarge.

  9. Click Deploy. Deployment succeeds when service status changes to Running.

All configuration options are documented in Parameters for custom deployment.

Test the service

After deployment, test the service endpoint using the EAS online debugging tool.

  1. On the EAS instance list page, click the instance name. On the instance details page, click Online Debugging.

  2. Enter the request URL for web.py (for example, the /hello route) and click Send Request. A "Hello, World!" response confirms the service is running.

  3. To invoke the service from the internet or a VPC, use the methods described in Service invocation methods.

image

Related information