> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/aws-sagemaker

Orb for deploying models to Amazon SageMaker and tracking releases in CircleCI. (OPEN PREVIEW - send feedback at sagemaker-integration-feedback@circleci.com)


## Commands

### create_endpoint_configuration

This command creates an create an endpoint configuration.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `bucket` | string |  | S3 bucket for the model |
| `circle_pipeline_id` | string |  | CircleCI pipeline ID |
| `circle_project_id` | string |  | CircleCI project ID |
| `endpoint_instance_count` | integer | 1 | Number of instances to run endpoint inference |
| `endpoint_instance_type` | string | ml.t2.medium | EC2 instance type to run endpoint inference |
| `model_name` | string |  | Model name |
| `region_name` | string | us-east-1 | AWS region name |

### create_model

This command creates a sagemaker model with latest model package.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `bucket` | string |  | S3 bucket for the model |
| `circle_pipeline_id` | string |  | CircleCI pipeline ID |
| `model_name` | string |  | Model name |
| `region_name` | string | us-east-1 | AWS region name |

### deploy_endpoint

This command deploys inference endpoint by create or update


| Parameter | Type | Default | Description |
|---|---|---|---|
| `bucket` | string |  | S3 bucket for the model |
| `circle_pipeline_id` | string |  | CircleCI pipeline ID |
| `circle_project_id` | string |  | CircleCI project ID |
| `enable_restore_version` | string | true | Enable restoring releases on circleci |
| `enable_scaling_component` | string | true | Enable scaling release components on circleci |
| `endpoint_config_name` | string |  | Existing endpoint config name |
| `endpoint_name` | string |  | Existing endpoint name |
| `model_desc` | string |  | sagemaker model desription |
| `model_name` | string |  | Model name |
| `region_name` | string |  | AWS region name |

### setup

This command downloads the sagemaker cli binary.


## Jobs

### create_endpoint_configuration

This job creates an create an endpoint configuration.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `bucket` | string |  | S3 bucket for the model |
| `circle_pipeline_id` | string |  | CircleCI Pipeline ID |
| `circle_project_id` | string |  | CircleCI project ID |
| `endpoint_instance_count` | integer | 1 | Number of instances to run endpoint inference |
| `endpoint_instance_type` | string | ml.t2.medium | EC2 instance type to run endpoint inference |
| `model_name` | string |  | Model name |
| `region_name` | string |  | AWS region name |

### create_model

This job creates sagemaker model given a model package available in registry.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `bucket` | string |  | S3 bucket for the model |
| `circle_pipeline_id` | string |  | CircleCI Pipeline ID |
| `model_name` | string |  | Model name |
| `region_name` | string |  | AWS region name |

### deploy_endpoint

This job deploys inference endpoint by create or update


| Parameter | Type | Default | Description |
|---|---|---|---|
| `bucket` | string |  | S3 bucket for the model |
| `circle_pipeline_id` | string |  | CircleCI Pipeline ID |
| `circle_project_id` | string |  | CircleCI project ID |
| `enable_restore_version` | string | true | Enable restoring releases on circleci |
| `enable_scaling_component` | string | true | Enable scaling release components on circleci |
| `endpoint_config_name` | string |  | Existing endpoint config name |
| `endpoint_name` | string |  | Existing endpoint name |
| `model_desc` | string |  | sagemaker model desription |
| `model_name` | string |  | Model name |
| `region_name` | string |  | AWS region name |

## Examples

### deploy_model

This example defines a CircleCI workflow that uses the aws-sagemaker orb to:
  - Create a SageMaker model
  - Create an endpoint configuration for the model
  - Deploy the model to an endpoint
It shows a typical machine learning workflow using SageMaker with model releases being tracked on CircleCI.


```yaml
version: '2.1'
orbs:
  aws-sagemaker: circleci/aws-sagemaker@1.0
workflows:
  ai-workflow:
    jobs:
      - aws-sagemaker/create_model:
          bucket: replace_with_s3_bucket_name
          model_name: replace_with_model_name
          name: create-model
          pipeline_id: << pipeline.id >>
          region_name: replace_with_region_name
      - aws-sagemaker/create_endpoint_configuration:
          bucket: replace_with_s3_bucket_name
          model_name: replace_with_model_name
          name: create-endpoint-configuration
          pipeline_id: << pipeline.id >>
          region_name: replace_with_region_name
          requires:
            - create-model
      - aws-sagemaker/deploy_endpoint:
          bucket: replace_with_s3_bucket_name
          model_desc: replace_with_description
          model_name: replace_with_model_name
          name: deploy-endpoint
          pipeline_id: <<pipeline.id>>
          project_id: replace_with_project_id
          region_name: replace_with_region_name
          requires:
            - create-endpoint-configuration
```

### deploy_model_with_endpoint_config_name

Deploys a model to SageMaker with an existing endpoint configuration.


```yaml
version: '2.1'
orbs:
  aws-sagemaker: circleci/aws-sagemaker@1.0
workflows:
  ai-workflow:
    jobs:
      - aws-sagemaker/deploy_endpoint:
          bucket: replace_with_s3_bucket_name
          endpoint_config_name: replace_with_existing_endpoint_config_name
          endpoint_name: replace_with_endpoint_name
          model_desc: replace_with_description
          model_name: replace_with_model_name
          name: deploy-endpoint
          pipeline_id: <<pipeline.id>>
          project_id: replace_with_project_id
          region_name: replace_with_region_name
```