2

I am trying to deploy a Go app to Elastic beanstalk (through the UI)

What I've done:

  • Created a single application.go file which listens on Port 5000
  • Compiled for Linux (set GOOS=linux and GOARCH=amd64) using the command found here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/go-environment.html
    • go build -o bin/application application.go
  • zipped the bin folder and uploaded it to Elastic Beanstalk (I've also tried uploading the file without the bin folder)

For development I'm using go version go1.18.1 windows/amd64

Under Platform in Elastic Beanstalk I see: Go 1 running on 64bit Amazon Linux 2/3.5.1

According to https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.go go v. 1.18.1 is supported

My Code:

package main
import (
    "fmt"
    "net/http"
    "time"
)
func main() {
    http.HandleFunc("/", index)
    fmt.Println("Now serving!!!")
    http.ListenAndServe(":5000", nil)
}
func index(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "My Res !!! %s", time.Now())
}

The Application health is "no data".

With the most recent event of "Environment health has transitioned from Pending to No Data. None of the instances are sending data."

When I look in chrome dev tools and try to open the link, I just get (failed) net:ERR_CONNECTION_RESET. "Failed to load response data: No Resource with given identifier found"

Potential Issues:

  • When I look at the configuration tab, I see that this environment is not part of a VPC. Could that be the issue?

Some Potential Next Steps:

  • Test running on WSL
  • Test deploying on a standalone EC2
  • Try deploying through the CLI
  • Try wrapping in a docker container and deploying docker (though this wouldn't actually solve my problem, I'd like to be able to deploy without docker)
0

1 Answer 1

1

I tried to replicate your issue using your code, but everything is fine. My EB environment works and deploys perfectly with your code.

The only thing I can think of is that I used linux to create my binary, while you've used windows/amd64. I don't think those binaries are interchangeable.

Sign up to request clarification or add additional context in comments.

2 Comments

I am compiling for linux, but I haven't actually tested that it runs on linux, that'll be my next step
So now it's working fine. I looked in the sample app and it was not compiled. I'm uploading a zip folder with the source files (Which is what I originally did in the first place :/ ) so I'm not sure what is different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.