Create a service environment in
AWS Batch
Before you can run SageMaker Training jobs in AWS Batch, you need to create a service
environment. You can create a service environment that contains the configuration parameters
required for AWS Batch to integrate with SageMaker AI services and submit SageMaker Training jobs on your
behalf.
Prerequisites
Before creating a service environment, ensure you have:
- Create a service environment (AWS Console)
-
Use the AWS Batch console to create a service environment through the web
interface.
To create a service environment
-
Open the AWS Batch console at https://console.aws.amazon.com/batch/.
-
In the navigation pane, choose Environments.
-
Choose Create environment, select
Service environment.
-
For Service environment configuration
choose SageMaker AI.
-
For Name, enter a unique name for
your service environment. Valid characters are a-z, A-Z, 0-9, hyphens
(-), and underscores (_).
-
For Max number of instances enter the
maximum number of concurrent training instances
-
(Optional) Add tags by choosing Add
tag and entering key-value pairs.
-
Choose Next.
-
Review the details of the new service environment and choose Create service environment.
- Create a service environment (AWS CLI)
-
Use the create-service-environment
command to create a service
environment with the AWS CLI.
To create a service environment
-
Create a service environment with the basic required
parameters:
aws batch create-service-environment \
--service-environment-name my-sagemaker-service-env \
--service-environment-type SAGEMAKER_TRAINING \
--capacity-limits capacityUnit=NUM_INSTANCES,maxCapacity=10
-
(Optional) Create a service environment with tags:
aws batch create-service-environment \
--service-environment-name my-sagemaker-service-env \
--service-environment-type SAGEMAKER_TRAINING \
--capacity-limits capacityUnit=NUM_INSTANCES,maxCapacity=10 \
--tags team=data-science,project=ml-training
-
Verify the service environment was created successfully:
aws batch describe-service-environments \
--service-environment my-sagemaker-service-env
The service environment appears in the Environments list with a
CREATING
state. When creation completes successfully, the state
changes to VALID
and the service environment is ready to have a
service job queue added to it so the service environment can start processing
jobs.