---
title: Avra RFM on AWS SageMaker
description: Run Avra RFM in your own AWS account. Subscribe on AWS Marketplace, then run training and inference jobs on Amazon SageMaker.
---

Avra RFM is available on AWS Marketplace as an AWS SageMaker algorithm. You subscribe with your AWS account, and Amazon SageMaker runs the model as jobs in that account. Your data never leaves it.

Setting up takes five steps: you agree on the license with your Avra team, you subscribe, you request service quotas, you prepare S3 and an execution role, and you run jobs. This page covers each step, then the IAM, S3, and network setup the jobs need, and what stays in your account.

## How it works

| Job | What it does | Output |
|-----|--------------|--------|
| **Inference** | Scores the records you send | Scores, written to your S3 |
| **Training** | Adapts a copy of the RFM to your database, or fine-tunes it on a task | A copy exclusive to your workspace, written to your S3 encrypted |

Training jobs are for [adaptation and fine-tuning](/rfm/adaptation).

Jobs read the data the [ingestion pipeline](/data-ingestion) published in your environment from S3 in your account. An inference job reads the records you send for scoring and writes their scores. A training job writes your adapted or fine-tuned copy, and later inference jobs read it from there.

<svg class="fig" viewBox="0 0 640 272" role="img" aria-label="Inside your AWS account: on the left, published data and records to score in your S3; in the middle, a training job and an inference job on SageMaker, network-isolated; on the right, your encrypted copy and scores in your S3. Published data feeds both jobs, and records to score feed the inference job. The training job writes your copy, which later inference jobs load, and the inference job writes scores.">
  <defs>
    <marker id="fig-sm-arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
      <path d="M0,0 L10,5 L0,10 z" class="arrow" />
    </marker>
    <marker id="fig-sm-arrow-accent" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
      <path d="M0,0 L10,5 L0,10 z" class="arrow-accent" />
    </marker>
  </defs>
  <rect class="rule dash" x="16" y="16" width="608" height="240" rx="12" />
  <text class="small title label" x="32" y="40">Your AWS account</text>
  <text class="small label mid" x="112" y="64">Inputs in your S3</text>
  <text class="small label mid" x="320" y="64">Jobs on SageMaker</text>
  <text class="small label mid" x="532" y="64">Outputs in your S3</text>
  <rect class="card" x="32" y="80" width="160" height="44" rx="8" />
  <text class="small title" x="48" y="99">Published data</text>
  <text class="small label" x="48" y="115">from data ingestion</text>
  <rect class="card" x="32" y="176" width="160" height="44" rx="8" />
  <text class="small title" x="48" y="195">Records to score</text>
  <text class="small label" x="48" y="211">sent for scoring</text>
  <rect class="solid" x="240" y="80" width="160" height="44" rx="8" />
  <text class="small title on-solid mid" x="320" y="99">Training job</text>
  <text class="small on-solid mid" x="320" y="115">adapts or fine-tunes</text>
  <rect class="solid" x="240" y="176" width="160" height="44" rx="8" />
  <text class="small title on-solid mid" x="320" y="195">Inference job</text>
  <text class="small on-solid mid" x="320" y="211">scores records</text>
  <text class="small label mid" x="320" y="242">network-isolated</text>
  <rect class="soft" x="448" y="80" width="168" height="44" rx="8" />
  <text class="small title" x="464" y="99">Your copy, encrypted</text>
  <text class="small label" x="464" y="115">adapted or fine-tuned</text>
  <rect class="card" x="448" y="176" width="168" height="44" rx="8" />
  <text class="small title" x="464" y="195">Scores</text>
  <text class="small label" x="464" y="211">for the records sent</text>
  <line class="edge" x1="192" y1="102" x2="236" y2="102" marker-end="url(#fig-sm-arrow)" />
  <line class="edge" x1="400" y1="102" x2="444" y2="102" marker-end="url(#fig-sm-arrow)" />
  <path class="edge" d="M192,112 C216,112 212,190 236,190" marker-end="url(#fig-sm-arrow)" />
  <line class="edge" x1="192" y1="206" x2="236" y2="206" marker-end="url(#fig-sm-arrow)" />
  <line class="edge" x1="400" y1="198" x2="444" y2="198" marker-end="url(#fig-sm-arrow)" />
  <path class="edge-accent dash" d="M532,124 V142 Q532,150 524,150 H328 Q320,150 320,158 V172" marker-end="url(#fig-sm-arrow-accent)" />
  <text class="small label mid" x="424" y="144">loaded by later jobs</text>
</svg>

Everything happens in your AWS account. Both jobs read the published data from your S3, inference jobs also read the records you send, and inference jobs load the encrypted copy a training job writes.

The algorithm's image is self-contained. It carries the code, its dependencies, and the pre-trained model. Jobs run with network isolation: they download nothing when they run and can't reach the internet.

The pre-trained model and every adapted or fine-tuned copy are encrypted. You run them, but you can't extract the weights. Your adapted copy moves from the training job that produced it to the inference jobs that use it.

Start jobs from the SageMaker console, the SageMaker APIs and SDKs, or your own ML platform, like any SageMaker algorithm, or have Avra orchestrate them.

## Before you start

| What you provide | Notes |
|------------------|-------|
| **An AWS account with Amazon SageMaker** | In the AWS Region where your data lives |
| **S3 locations** | For the jobs' inputs and outputs, in the same Region as the jobs |
| **An execution role** | The IAM role SageMaker assumes to read the inputs and write the outputs |
| **Service quotas** | For the instance types your Avra team recommends for your data |
| **Subnets and security groups** | Only if your data must be read from inside your VPC |

## Set up

1. **Agree on the license**

    Running Avra RFM in your account is licensed. Agree on the terms with your Avra team before you subscribe.

2. **Subscribe**

    Subscribe from the AWS account where your data lives, then configure the product for the AWS Region where it lives. The person who subscribes needs permission to manage AWS Marketplace subscriptions, such as the `AWSMarketplaceManageSubscriptions` managed policy. The algorithm then becomes available to Amazon SageMaker in that account, under its own ARN for that Region.

3. **Request service quotas**

    Request service quotas in that Region for the instance types your Avra team recommends for your data.

4. **Prepare S3 and an execution role**

    Create S3 locations for inputs and outputs, and an IAM execution role that SageMaker assumes to read the inputs and write the outputs. See [IAM](#iam) and [S3](#s3).

5. **Run jobs**

    Run inference jobs to score records, and training jobs to adapt or fine-tune a copy.

### See what the algorithm expects

The algorithm describes itself. Describe it with its ARN, in the Region you configured it for:

```bash AWS CLI
aws sagemaker describe-algorithm \
  --algorithm-name <algorithm-arn> \
  --region <region>
```

```python Python
import boto3

sagemaker = boto3.client("sagemaker", region_name="<region>")
algorithm = sagemaker.describe_algorithm(AlgorithmName="<algorithm-arn>")

training = algorithm["TrainingSpecification"]
print(training["SupportedTrainingInstanceTypes"])
for channel in training["TrainingChannels"]:
    print(channel["Name"], channel.get("IsRequired", False))
```

`TrainingSpecification` lists the training job's input channels and the instance types it supports, and `InferenceSpecification` describes inference.

## IAM

Two identities take part. The person who subscribes needs permission to manage AWS Marketplace subscriptions, as described in the setup steps. The jobs run as an execution role, which SageMaker assumes to read each job's inputs from S3, write its outputs, and write its logs and metrics to CloudWatch in your account. Whoever starts the jobs, you or your ML platform, also needs `iam:PassRole` on that role, so it can hand the role to SageMaker.

The role's trust policy lets SageMaker assume it:

```json trust-policy.json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "Service": "sagemaker.amazonaws.com" },
      "Action": "sts:AssumeRole"
    }
  ]
}
```

Its permissions policy lets it read the inputs, write the outputs, and describe the algorithm, which SageMaker requires for jobs that run an algorithm. This example keeps everything in one bucket, `rio-claro-avra`, under three prefixes: `published/` for the data the ingestion pipeline publishes, `to-score/` for the records you send, and `outputs/` for what the jobs write. Inference jobs also read `outputs/`, where training jobs leave your adapted copies.

```json data-policy.json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ListBucket",
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::rio-claro-avra"
    },
    {
      "Sid": "ReadInputs",
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": [
        "arn:aws:s3:::rio-claro-avra/published/*",
        "arn:aws:s3:::rio-claro-avra/to-score/*",
        "arn:aws:s3:::rio-claro-avra/outputs/*"
      ]
    },
    {
      "Sid": "WriteOutputs",
      "Effect": "Allow",
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::rio-claro-avra/outputs/*"
    },
    {
      "Sid": "DescribeAlgorithm",
      "Effect": "Allow",
      "Action": "sagemaker:DescribeAlgorithm",
      "Resource": "arn:aws:sagemaker:*:*:algorithm/*"
    },
    {
      "Sid": "JobLogsAndMetrics",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:DescribeLogStreams",
        "logs:PutLogEvents",
        "cloudwatch:PutMetricData"
      ],
      "Resource": "*"
    }
  ]
}
```

Create the role with the policies:

```bash AWS CLI
aws iam create-role \
  --role-name AvraRfmExecution \
  --assume-role-policy-document file://trust-policy.json

aws iam put-role-policy \
  --role-name AvraRfmExecution \
  --policy-name AvraRfmData \
  --policy-document file://data-policy.json
```

```hcl Terraform
resource "aws_iam_role" "avra_rfm" {
  name               = "AvraRfmExecution"
  assume_role_policy = file("${path.module}/trust-policy.json")
}

resource "aws_iam_role_policy" "avra_rfm_data" {
  name   = "AvraRfmData"
  role   = aws_iam_role.avra_rfm.id
  policy = file("${path.module}/data-policy.json")
}
```

If your bucket uses SSE-KMS, also allow the role `kms:Decrypt` to read and `kms:GenerateDataKey` to write, on that key. If the jobs run in your VPC, the role also needs the EC2 permissions AWS documents for SageMaker jobs in a VPC, which let SageMaker create network interfaces in your subnets.

## S3

Keep the jobs' S3 locations in the same Region as the jobs. The example on this page uses three prefixes in one bucket, `s3://rio-claro-avra`:

| Prefix | Holds | Written by | Read by |
|--------|-------|------------|---------|
| `published/` | The data the ingestion pipeline publishes | The ingestion pipeline | Training and inference jobs |
| `to-score/` | The records you send for scoring | You | Inference jobs |
| `outputs/` | Your adapted or fine-tuned copies, and scores | Training jobs and inference jobs | Inference jobs, which load your copy |

Every adapted or fine-tuned copy is written to your S3 encrypted. You can also encrypt the jobs' outputs and their storage volumes with your own AWS KMS keys, as with any SageMaker job.

## Network isolation and your VPC

Every job runs with network isolation. The job's container has no network access: it can't reach the internet, other AWS services, or Avra. SageMaker itself reads the job's inputs from S3 and writes its outputs back, using the execution role, so the container never needs a connection of its own.

```mermaid
---
config:
  sequence:
    width: 110
    actorMargin: 30
---
sequenceDiagram
    autonumber
    participant You as You or your<br/>ML platform
    participant SM as Amazon<br/>SageMaker
    participant S3 as Your S3
    participant J as Job<br/>container
    You->>SM: Start a job
    SM->>S3: Read the inputs
    SM->>J: Run on the inputs
    Note over J: No network access
    J-->>SM: Results
    SM->>S3: Write the outputs
```

If your data must be read from inside your VPC, run the jobs in your VPC. A job in your VPC runs in subnets and security groups you choose, and SageMaker routes its reads and writes to S3 through those subnets, while the job's container stays isolated. Subnets without a route to the internet need a route to S3 of their own, such as a gateway VPC endpoint.

## What stays in your account

The jobs can't reach Avra or anything else. Your data, the records you score, their scores, and every adapted or fine-tuned copy stay in your S3, and each job's logs stay in CloudWatch Logs in your account. Only execution metadata and aggregated metrics return to Avra.

| What | Where it's kept | Returns to Avra |
|------|-----------------|-----------------|
| **Your data**, and the versions the ingestion pipeline publishes | Your S3 | No |
| **The records you score**, and their scores | Your S3 | No |
| **Adapted and fine-tuned copies** | Your S3, encrypted | No |
| **Job logs** | CloudWatch Logs, in your account | No |
| **Execution metadata and aggregated metrics** | Your account and Avra | Yes |

If you have Avra orchestrate your jobs, you set up the access that takes with your Avra team.

## License

Running the RFM in your account is licensed. The license covers confidentiality, prohibits reverse engineering, and requires customer-specific model artifacts, caches, and intermediate data to be destroyed when the agreement ends. Your agreement sets out the specifics.

## Every version is governed

The algorithm's releases are governed like every Avra model: authorized by Avra's research team and approved by someone who didn't train them. Evaluate each version on your history before it serves decisions. See [Evaluation](/rfm/evaluation).

**[Adaptation and fine-tuning](/rfm/adaptation)**

When a copy of the RFM that learns from your data pays off

**[Evaluation](/rfm/evaluation)**

How to judge a version on your history before it serves decisions

**[Install the data layer](/deployment/data-layer)**

Run the ingestion pipeline that publishes the data the jobs read

**[Deployment](/deployment)**

What runs where, and what crosses the boundary
