Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Delete a service environment in
Amazon Batch
You can delete a service environment when it's no longer needed for your SageMaker Training
jobs. Deleting a service environment removes the configuration and prevents
further job submissions. Before deleting a service
environment, ensure that no active SageMaker Training jobs depend on it and that no job
queues are associated with the service environment.
Service environment deletion is irreversible. Once deleted, you cannot recover the
service environment or its configuration. If you need similar functionality in the
future, you must create a new service environment with the required settings. Consider
disabling the service environment instead of deletion if you may need to reactivate it
later.
Deleting all service environments in your account does not automatically remove the
service-linked role created for Amazon Batch and SageMaker AI integration. The service-linked role
remains available for future service environment creation. If you want to remove the
service-linked role, you must delete it separately using IAM after ensuring no service
environments exist in your account.
Deletion
prerequisites
Before you can delete a service environment you must disassociate any service job
queue and then disable the service environment.
Before deleting a service environment:
-
Check active jobs - Ensure no SageMaker Training
jobs are currently running through the service environment.
-
Review job queues - Identify job queues
associated with the service environment and either associate the job queue with
a different service environment or disable and delete the job queue.
Job queue management: Job queues that were associated
with a deleted service environment can still exist but cannot process service jobs. You
should either delete unused job queues or associate them with a different service
environment before deleting the original service environment.
- Delete a service environment (Amazon
Console)
-
Use the Amazon Batch console to delete a service environment through the web
interface.
To delete a service environment
-
Open the Amazon Batch console at https://console.aws.amazon.com/batch/.
-
In the navigation pane, choose Environments.
-
Choose the Service environment tab and then choose a
service environment.
-
If the service environment is enabled, choose Actions and then Disable.
-
Once the service environment is disabled, choose Actions and then Delete.
-
In the confirmation dialog, choose Confirm.
The service environment shows a DELETING
state while deletion occurs.
Once deletion completes, the service environment disappears from the Environments
list.
- Delete a service environment (Amazon
CLI)
-
Use the delete-service-environment
command to remove a service
environment with the Amazon CLI.
To delete a service environment
-
Check for associated job queues with the service environment:
aws batch describe-job-queues
If there are any job queues associated with the service environment
you can either disassociate the job queue from the
service environment and associate it with a different service
environment, or delete the job queue.
-
Disable the service environment:
aws batch update-service-environment \
--service-environment my-sagemaker-service-env \
--state DISABLED
-
Delete the service environment:
aws batch delete-service-environment \
--service-environment my-sagemaker-service-env
-
Monitor the deletion process:
aws batch describe-service-environments \
--service-environment my-sagemaker-service-env
The service environment transitions to DELETING
state during the deletion
process. Once deletion completes, the service environment is no longer listed in
describe operations. Associated job queues remain but cannot process service jobs until
associated with a different service environment.