func (e *ECS) listTaskArns(serviceName string) error {
	e.taskArns = []string{}
	input := &ecs.ListTasksInput{
		Cluster:     aws.String(e.selectedClusterName),
		ServiceName: aws.String(serviceName),
	}
	pageNum := 0
	err := e.svc.ListTasksPages(input,
		func(page *ecs.ListTasksOutput, lastPage bool) bool {
			pageNum++
			e.taskArns = append(e.taskArns, aws.StringValueSlice(page.TaskArns)...)
			return pageNum <= 20
		})
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			ecsLogger.Errorf(aerr.Error())
		} else {
			ecsLogger.Errorf(err.Error())
		}
		return err
	}
	return nil
}
lists task arns
package main
import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/ec2"
	"github.com/aws/aws-sdk-go/service/ecs"
	"github.com/juju/loggo"
	"errors"
	"math"
	"os"
	"strings"
)
var ecsLogger = loggo.GetLogger("ecs")
type ECS struct {
	clusterArns         []*string
	serviceArns         []*string
	taskArns            []string
	clusterNames        []string
	serviceNames        []string
	taskNames           []string
	containerInstances  map[string]string
	selectedClusterName string
	selectedServiceName string
	ipAddr              *string
	keyName             *string
	svc                 *ecs.ECS
}
func newECS() *ECS {
	e := ECS{}
	if os.Getenv("AWS_REGION") == "" {
		os.Setenv("AWS_REGION", "us-east-1")
	}
	e.svc = ecs.New(session.New())
	e.listCluster()
	e.getClusterNames()
	return &e
}
func (e *ECS) listCluster() error {
	input := &ecs.ListClustersInput{}
	pageNum := 0
	err := e.svc.ListClustersPages(input,
		func(page *ecs.ListClustersOutput, lastPage bool) bool {
			pageNum++
			e.clusterArns = append(e.clusterArns, page.ClusterArns...)
			return pageNum <= 20
		})
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			ecsLogger.Errorf(aerr.Error())
		} else {
			ecsLogger.Errorf(err.Error())
		}
		return err
	}
	return nil
}
func (e *ECS) getClusterNames() error {
	input := &ecs.DescribeClustersInput{
		Clusters: e.clusterArns,
	}
	result, err := e.svc.DescribeClusters(input)
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			ecsLogger.Errorf(aerr.Error())
		} else {
			ecsLogger.Errorf(err.Error())
		}
		return err
	}
	for _, cluster := range result.Clusters {
		e.clusterNames = append(e.clusterNames, *cluster.ClusterName)
	}
	return nil
}
func (e *ECS) listServiceArns(clusterName string) error {
	e.serviceArns = []*string{}
	input := &ecs.ListServicesInput{
		Cluster: aws.String(clusterName),
	}
	pageNum := 0
	err := e.svc.ListServicesPages(input,
		func(page *ecs.ListServicesOutput, lastPage bool) bool {
			pageNum++
			e.serviceArns = append(e.serviceArns, page.ServiceArns...)
			return pageNum <= 20
		})
	if err != nil {
		if aerr, ok := err.(awserr.Error); ok {
			ecsLogger.Errorf(aerr.Error())
		} else {
			ecsLogger.Errorf(err.Error())
		}
		return err
	}
	return nil
}
func (e *ECS) getServices(clusterName string) ([]string, error) {
	e.selectedClusterName = clusterName
	err := e.listServiceArns(clusterName)
	if err != nil {
		return []string{}, err
	}
	var y float64 = float64(len(e.serviceArns)) / 10
	for i := 0; i < int(math.Ceil(y)); i++ {
		f := i * 10
		t := int(math.Min(float64(10+10*i), float64(len(e.serviceArns))))
		input := &ecs.DescribeServicesInput{
			Cluster:  aws.String(clusterName),
			Services: e.serviceArns[f:t],
		}
		result, err := e.svc.DescribeServices(input)
		if err != nil {
			if aerr, ok := err.(awserr.Error); ok {
				ecsLogger.Errorf(aerr.Error())
			} else {
				ecsLogger.Errorf(err.Error())
			}
			return []string{}, err
		}
		for _, service := range result.Services {
			e.serviceNames = append(e.serviceNames, *service.ServiceName)
		}
	}
	return e.serviceNames, nil
}