Set Up AutoGluon-Cloud on AWS¶
First, install the autogluon.cloud package:
pip install autogluon.cloud
AutoGluon-Cloud runs training and inference on Amazon SageMaker on your behalf. 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 data and store trained models
Attention
SageMaker compute and S3 storage are billed to your AWS account. AutoGluon-Cloud is a free wrapper, but it’s your responsibility to monitor usage and delete endpoints when no longer needed.
There are three ways to supply these resources — if you’re unsure, start with option 1.
1. Create new resources with bootstrap()¶
Run this if you don’t yet have an IAM role and S3 bucket set up for SageMaker. The role and bucket are provisioned on your account from a CloudFormation template and saved under ~/.autogluon/cloud.yaml for future calls.
from autogluon.cloud import bootstrap
bootstrap()
autogluon-cloud bootstrap
2. Use existing resources with register()¶
Run this if you already have an IAM role and S3 bucket that you want to use with AutoGluon-Cloud. The values are saved under ~/.autogluon/cloud.yaml for future calls.
from autogluon.cloud import register
register(
role="arn:aws:iam::222222222222:role/MyAutoGluonRole",
bucket="my-autogluon-bucket",
region="us-east-1",
)
autogluon-cloud register \
--role arn:aws:iam::222222222222:role/MyAutoGluonRole \
--bucket my-autogluon-bucket \
--region us-east-1
The role must trust the sagemaker.amazonaws.com principal and have permissions equivalent to AWS’s AmazonSageMakerFullAccess managed policy plus read/write access to your bucket. The region where the jobs are executed must match the bucket’s region.
3. Pass resources on each call¶
Skip the saved config entirely and provide the role and bucket every time you create a CloudPredictor or FoundationModel.
from autogluon.cloud import TabularCloudPredictor
predictor = TabularCloudPredictor(
cloud_output_path="s3://my-autogluon-bucket/output",
role="arn:aws:iam::222222222222:role/MyAutoGluonRole",
)
Useful for one-off scripts or when you need different roles and buckets per call. The same role and bucket requirements as option 2 apply.
Managing the saved config¶
Once bootstrap() or register() has written to ~/.autogluon/cloud.yaml, you may want to check that the role and bucket are still healthy before a long training run, or clean everything up when you’re done with AutoGluon-Cloud. Two helper commands cover both:
status()checks that the saved role and bucket still exist and are accessible — handy after IAM or S3 changes.teardown()deletes the CloudFormation stack created bybootstrap()and clears the saved config. Resources registered viaregister()are left untouched, since you own them.
The config path can be overridden with the AG_CONFIG_DIR environment variable if you’d rather keep it somewhere other than ~/.autogluon/.