How do I check if an AWS Fargate instance is already running in golang?
I was thinking of providing a name in the config so when you try to start another instance with one already running it doesn't work because the name is the same.
This is how I'm starting the task:
client := ecs.NewFromConfig(cfg)
runTaskIn := &ecs.RunTaskInput{
TaskDefinition: aws.String(appConfig.TaskDefinitionArn),
Cluster: aws.String(appConfig.Cluster),
NetworkConfiguration: &types.NetworkConfiguration{
AwsvpcConfiguration: &types.AwsVpcConfiguration{
Subnets: []string{
appConfig.SubnetID,
},
AssignPublicIp: types.AssignPublicIpEnabled,
},
},
LaunchType: types.LaunchTypeFargate,
}
Could setting the ReferenceId be a possible solution?