From https://aws.amazon.com/ec2/instance-types/a1/ — “ Amazon EC2 A1 instances deliver significant cost savings for scale-out and Arm-based applications such as web servers, containerized microservices, caching fleets, and distributed data stores that are supported by the extensive Arm ecosystem. A1 instances are the first EC2 instances powered by AWS Graviton Processors that feature 64-bit Arm Neoverse cores and custom silicon designed by AWS. These instances will also appeal to developers, enthusiasts, and educators across the Arm developer community. Most architecture-agnostic applications that can run on Arm cores could also benefit from A1 instances.”
Given that running containerized microservices are a big target segment for A1 instances, I wanted to try them on AWS container services like Amazon ECS (on EC2) and Amazon Elastic Kubernetes Service (EKS)>
On Amazon ECS
I created an ECS Cluster and made sure to select EC2 A1 instances as part of the cluster. If you have enabled access via SSH you can run some basic Linux commands to verify the processor type ..
Inside the A1 EC2 instance:

While you get the following in a normal x86 t2.micro:

Once the cluster is created, running containers as ECS services on these instances is straightforward. I tested initially with an Task definition for an nginx image and it ran successfully ..
But, I was looking for an small application that can display the processor type of the host just for kicks ;-) as most lazy programmers do, I googled for an existing app and I found an awesome blog (though in Japanese) at https://qiita.com/hideaki_aoyagi/items/877e8316cbb35293dfb0
This blog has a small Go application that displays the hostname, operating system and processor architecture. I have added these files into my githib repo at https://github.com/cmanikandan/aws-ec2a1-containers . You can clone this repo and test it out ..
Dockerfile
FROM golang:latest AS builder
WORKDIR /tmp
ADD ./go-webserver-sample.go /tmp
RUN GOOS=linux CGO_ENABLED=0 GOARCH=arm64 go build -o go-webserver-sample .FROM alpine:latest
COPY — from=builder /tmp/go-webserver-sample /bin/
CMD [“/bin/go-webserver-sample”]
The only change that I had to make from the original blog, was to add GOARCH=arm64 before doing the go build command.
The Go code:
package main
import (
“fmt”
“net/http”
“os”
“runtime”
)func handler(w http.ResponseWriter, r *http.Request) {
hostname, _ := os.Hostname()
fmt.Fprintf(w, “<h1>Welcome Golang-WebServer!</h1>”)
fmt.Fprintf(w, “<h2>Hostname: %s</h2>”, hostname)
fmt.Fprintf(w, “<h2>OS: %s</h2>”, runtime.GOOS)
fmt.Fprintf(w, “<h2>Architecture: %s</h2>”, runtime.GOARCH)
}func main() {
http.HandleFunc(“/”, handler)
http.ListenAndServe(“:8080”, nil)
}
Push the image to Amazon ECR, create a Task definition and create an ECS service.
Voila, I get the details of the underlying host via the ECS service when I call the ECS service ..

On Amazon EKS:
There is an ongoing preview to run containers using EC2 A1 instances on a Kubernetes cluster that is managed by Amazon EKS.. More details are available at https://github.com/aws/containers-roadmap/tree/master/preview-programs/eks-ec2-a1-preview
Hopefully, in part 2 of this blog, I will post my experiences of running on EKS ..