I want to start an ECS Task with the AWS .NET SDK. But it throws the following exception:
"Network Configuration must be provided when networkMode 'awsvpc' is specified."
I use the AWS Fargate launch type and the code looks like this:
var ecsClient = new AmazonECSClient();
var runTaskRequest = new RunTaskRequest() {
Cluster = "arn:aws:ecs:xxxx:xxx:cluster/xxx-cluster",
TaskDefinition = "amttask", // uses latest revision,
};
await ecsClient.RunTaskAsync(runTaskRequest);
I can see no way to configure the vpc and subnet. In the AWS Console (Browser) I can specify this when launching the Task manually.
https://docs.aws.amazon.com/sdkfornet/latest/apidocs/items/TECSRunTaskRequestNET45.html
How can I add the network configuration to my code?
Update: I looked up v2 of the documentation and the current api version is v3