After introducing "Preconfigured Docker" as a new category of supported platforms in November 2014 with initial support for Java/GlassFish and Python 3.4 containers, Amazon Web Services (AWS) recently added Go versions 1.3 and 1.4 as the first additional language based on this new approach to its platform as a service offering AWS Elastic Beanstalk.
Adding support for Go shortly after the release of version 1.4 delivers on the goal to "quickly provide you with the newest versions of additional language/framework platforms". Notably, the new Amazon EC2 Container Service Agent is also developed in Go and expected to facilitate the likewise recently announced experimental AWS SDK for Go later on.
The preconfigured Docker platforms are based on the official repositories for language stacks on the Docker Hub Registry. Other than for the previously released customized preconfigured Docker images for Java/GlassFish and Python 3.4, AWS simply uses Docker's official language stack Go image directly:
# Use the Go 1.4 Docker Image
FROM golang:1.4.1-onbuild
A getting started with Go preconfigured Docker containers walkthrough illustrates the Docker enabled development workflow with a typical 'Hello World' example:
package main
import "github.com/go-martini/martini"
func main() {
m := martini.Classic()
m.Get("/", func() string {
return "Hello world!"
})
m.Run()
}
Both the package name 'main' and the 'main()' function are a requirement for the container to execute. Elastic Beanstalk sets the GOPATH to '/go' and downloads imported dependencies like 'go-martini' automatically during container deployment.
After an application has been developed and tested locally, it can be deployed to Elastic Beanstalk by creating an application source bundle and submitting it during the creation of a new application. The application source bundle can also include configuration files to customize the provisioned Elastic Beanstalk environment.
The announcement of preconfigured Docker containers for Go also includes Elastic Beanstalk support for the recently introduced C4 instance type and has been followed by a few smaller improvements like periodic worker tasks and cloning of environments.
The Elastic Beanstalk documentation features a developer guide and the API reference. A list of supported preconfigured Docker container types is also available. Support is provided via the AWS Elastic Beanstalk forum.