awslabs / fargatecli

CLI for AWS Fargate
Apache License 2.0
893 stars 114 forks source link

Automatically create cluster if ClusterNotFoundException #50

Open gsvitak opened 6 years ago

gsvitak commented 6 years ago

Hello,

Thank you for the CLI. It seems super awesome so far.

Question.. Do I have to have the cluster already defined/created if I do not want to use the default Fargate cluster?

I am currently receiving ClusterNotFoundException if I do fargate --cluster new_cluster task run long_running

Thanks G

amadkinnon commented 4 years ago

I just ran into this issue. Clustername argument on the command line is ignore. Fixed the issue in cmd/root.go by only setting cluster name to default if it is not set.

This still doesn't propogate through to the logging path. But it works for me.

$ diff root.go root.go.orig

140c140
<               }
---
>                       ecs := ECS.New(sess, clusterName)
142c142
<               ecs := ECS.New(sess, clusterName)
---
>                       output.Debug("Creating default cluster [API=ecs Action=CreateCluster]")
144c144
<               output.Debug("Creating default cluster [API=ecs Action=CreateCluster]")
---
>                       arn, err := ecs.CreateCluster()
146,151c146,150
<               arn, err := ecs.CreateCluster()
<
<               if err == nil {
<                       output.Debug("Created cluster [ARN=%s]", arn)
<               } else {
<                       output.Fatal(err, "Could not create default cluster")
---
>                       if err == nil {
>                               output.Debug("Created cluster [ARN=%s]", arn)
>                       } else {
>                               output.Fatal(err, "Could not create default cluster")
>                       }