Set Up AutoGluon-Cloud on AWS¶
AutoGluon-Cloud trains and deploys models on AWS SageMaker on your behalf. To do that, every CloudPredictor or FoundationModel you create needs two AWS resources:
An IAM role that SageMaker assumes to run training and inference jobs.
An S3 bucket to stage training data and store trained models.
You have two options for supplying them:
Save them once to
~/.autogluon/cloud.yaml, and AutoGluon-Cloud will pick them up automatically on every call. This is the recommended path — set it up withbootstraporregisterbelow.Pass them explicitly to each
CloudPredictor/FoundationModel, e.g.CloudPredictor(role="arn:aws:iam::...", cloud_output_path="s3://my-bucket/..."). Useful if you need different roles or buckets per call, or if you don’t want a config file on disk.
The rest of this page covers option 1.
Commands¶
AutoGluon-Cloud ships four commands for managing the saved configuration:
Command |
What it does |
When to use it |
|---|---|---|
Provisions a role and bucket via CloudFormation, then saves them. |
First-time setup with no existing AWS resources. |
|
Saves an existing role and bucket without provisioning anything. |
Your platform team already gave you a role and bucket. |
|
Verifies the saved resources still exist and are accessible. |
Sanity-check before training, or after IAM/S3 changes. |
|
Deletes resources created by |
Cleanup when you’re done with AutoGluon-Cloud. |
Each command is available both as a CLI subcommand (autogluon-cloud <command>) and as a Python function (from autogluon.cloud import <command>). The sections below show both forms.
Install¶
pip install -U autogluon.cloud
This installs the autogluon-cloud CLI alongside the Python API.
bootstrap¶
Provisions an IAM role and S3 bucket via CloudFormation, then saves them to ~/.autogluon/cloud.yaml. Use this if you don’t already have AWS resources for AutoGluon-Cloud.
bootstrap uses the standard boto3 credential resolution order to find your AWS credentials, so anything that works for the AWS CLI or boto3 will work here (aws configure, AWS_* environment variables, an active SSO session, or an instance profile). Run:
autogluon-cloud bootstrap
from autogluon.cloud import bootstrap
bootstrap()
The CloudFormation stack is named ag-cloud-sagemaker by default. Subsequent CloudPredictor calls pick the saved values up automatically.
Note
Review the CloudFormation template before deploying: src/autogluon/cloud/templates/ag_cloud_sagemaker.yaml.
register¶
Tells AutoGluon-Cloud to use an IAM role and S3 bucket you already have. Use this when your platform team has provisioned them for you and you want to skip CloudFormation.
autogluon-cloud register \
--role arn:aws:iam::222222222222:role/MyAutoGluonRole \
--bucket my-autogluon-bucket \
--region us-east-1
from autogluon.cloud import register
register(
role="arn:aws:iam::222222222222:role/MyAutoGluonRole",
bucket="my-autogluon-bucket",
region="us-east-1",
)
register makes no AWS calls — it only persists the values to ~/.autogluon/cloud.yaml. The IAM role must trust sagemaker.amazonaws.com and have permissions equivalent to AWS’s AmazonSageMakerFullAccess managed policy plus read/write access to your bucket.
status¶
Verifies that the saved IAM role, S3 bucket, and (if applicable) CloudFormation stack still exist and are accessible.
autogluon-cloud status
from autogluon.cloud import status
reports = status()
ok means the resource exists; ok (unverified ...) means the caller lacks the IAM permission to verify (the resource is probably fine, but status couldn’t confirm).
teardown¶
Deletes the CloudFormation stacks created by bootstrap and removes ~/.autogluon/cloud.yaml. Backends added via register only have their config entry removed — your existing role and bucket are left untouched.
autogluon-cloud teardown
from autogluon.cloud import teardown
teardown()
Warning
CloudFormation refuses to delete non-empty S3 buckets. If your bucket holds training artifacts you want to discard, empty it first with aws s3 rm s3://<bucket> --recursive.
Where the config lives¶
bootstrap and register both write to ~/.autogluon/cloud.yaml. The file is keyed by backend, so you can have separate entries for different backends side by side. Override the directory with the AG_CONFIG_DIR environment variable.