Search code examples
amazon-web-servicesamazon-ecs

Rename ECS Service


I have a bunch of Amazon ECS services that I want to re-name. I like their task definitions, so I'm open to cloning options, I just don't see in the UpdateService API a way to rename a service. Is there an API for renaming? If not, what combination of APIs could I invoke (I figure python or awscli scripting would be the easiest option).

Considerations

  • I would also want to consider whether it would be possible to gracefully roll the "old name" to "new name"
  • Ensure security groups were applied correctly.
  • If possible, facilitate the mutative change via CloudFormation

Solution

  • I don't see any options to rename an ECS service in CLI, API, even the console. I think you're going to have to remove the service with the old name and create a new one with the new name.

    There are lots of ways to make removing and creating a little easier on you:

    • If you are using Terraform to create and manage your ECS services, you can simply rename the service in Terraform, and it will drop and recreate the service when you apply the change.
    • AWS cli could certainly make this easier than doing it manually -- you could even create a wrapper script to do a rename, perhaps.
    • You could definitely drop and create the ECS service using Python and Boto3 (I don't use Python/Boto3 to rename services, but I do use it to drop and create services).
    • It's possible that CloudFormation could make this easier? I don't use CloudFormation, but since Terraform can make renaming an ECS service easier, it seems like CloudFormation might do the same.