As part of an automated deployment with the .NET AWS SDK, I am trying to create a new task definition revision, update the docker image tag label with my newly deployed version and then update a service to use that new revision.
I have something like this:
var taskDefinitionResponse = await _ecsClient.RegisterTaskDefinitionAsync(new RegisterTaskDefinitionRequest
{
ContainerDefinitions = new List<ContainerDefinition>(new[] {new ContainerDefinition(){Image = "new image:v123"}})
});
await _ecsClient.UpdateServiceAsync(new UpdateServiceRequest()
{
TaskDefinition = taskDefinitionResponse.TaskDefinition.TaskDefinitionArn,
});
My concern is with the above code it doesn't duplicate the existing task definition for example in AWS Console when you click "Create new revision" you have to select a task definition so that the button creates a duplicate so you can then modify it and save the new revision so would I need some code that gets an existing task definition then just change the docker image and then call the RegisterTaskDefinitionAsync
with the existing definition and modified docker image?