如何在Raspbian OS上运行AWS ecs-cli-Raspberry Pi 3 B +

I'm running Raspbian OS on Raspberry Pi 3 B+ and I'm trying to use it together with AWS ecs-cli to control my ECS containers by scaling them down and up. I'm planing to use Lambda in future, but as of now I'm trying to keep low metrics on CloudWatch to stay on free tier and do not get charged(separate topic).

I tried to install ecs-cli as per AWS guidance for Linux here

$ sudo curl -o /usr/local/bin/ecs-cli https://s3.amazonaws.com/amazon-ecs-cli/ecs-cli-linux-amd64-latest
$ sudo chmod +x /usr/local/bin/ecs-cli
$ ecs-cli

Obviously because the binary is for x86-64 OS I've got an error:

-bash: /usr/local/bin/ecs-cli: cannot execute binary file: Exec format error

Further check of the file suggests that ecs-cli is not compiled in architecture for raspbian:

$ file ecs-cli
ecs-cli: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
$ dpkg --print-architecture
armhf

I tried google around to find armhf compilation of ecs-cli, unfortunately without luck. Any idea?

I found source code of ecs-cli on GitHub, so I tried to clone it and compile.

$ pwd
/home/pi
$ git clone https://github.com/aws/amazon-ecs-cli.git
Cloning into 'amazon-ecs-cli'...
..., done.
$ cd amazon-ecs-cli
$ make
./scripts/build_binary.sh ./bin/local
./scripts/build_binary.sh: line 28: go: command not found
./scripts/build_binary.sh: line 32: go: command not found
Makefile:30: recipe for target 'bin/local/ecs-cli' failed
make: *** [bin/local/ecs-cli] Error 127

Error suggests I'm missing Golang installation on my Raspbian OS.

Install Golang 1.9 (or higher from here) and Godep on Raspbian OS:

$ cd ~
$ wget https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
$ sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
$ export PATH=$PATH:/usr/local/go/bin
$ go version
go version go1.9 linux/arm
$ go get -u github.com/tools/godep
$ export GOPATH=~/go
$ export PATH=$GOPATH/bin:$PATH
$ godep version
godep v80 (linux/arm/go1.9)
#Add paths into profile file;
$ echo "export GOPATH=~/go" >> $HOME/.profile
$ echo "export PATH=/usr/local/go/bin:\$GOPATH/bin:\$PATH" >> $HOME/.profile

Compile ecs-cli

$ cd ~/amazon-ecs-cli
$ make
./scripts/build_binary.sh ./bin/local
ecs-cli/main.go:29:2: cannot find package "github.com/cihub/seelog" in any of:
    /usr/local/go/src/github.com/cihub/seelog (from $GOROOT)
    /home/pi/go/src/github.com/cihub/seelog (from $GOPATH)
...

Looks like GO expects everything to be cloned into /usr/local/go/src/github.com (Please note that make command might be CPU intensive, I recommend to stop any other CPU intensive processes to avoid freeze of Raspberry Pi)

$ mkdir -p /usr/local/go/src/github.com/aws/
$ cd /usr/local/go/src/github.com/aws/
$ git clone https://github.com/aws/amazon-ecs-cli.git
..., done
$ cd /usr/local/go/src/github.com/aws/amazon-ecs-cli
$ make
./scripts/build_binary.sh ./bin/local
Built ecs-cli

Copy to target location and run it!

$ sudo cp /usr/local/go/src/github.com/aws/amazon-ecs-cli/bin/local/ecs-cli /usr/local/bin/
$ sudo chmod +x /usr/local/bin/ecs-cli
$ ecs-cli --version
ecs-cli version 1.5.0 (*UNKNOWN)

I can now run ecs-cli on Raspbian OS. Hopefully this will help to anyone who will be searching for similar errors. But is there easier way?