[英]Deploy Simple Go Webapp to Elastic Beanstalk
I am trying to deploy a Go app to Elastic beanstalk (through the UI)我正在尝试将 Go 应用程序部署到 Elastic beanstalk(通过 UI)
What I've done:我做了什么:
For development I'm using go version go1.18.1 windows/amd64对于开发,我使用 go 版本 go1.18.1 windows/amd64
Under Platform in Elastic Beanstalk I see: Go 1 running on 64bit Amazon Linux 2/3.5.1在 Elastic Beanstalk 的平台下,我看到: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根据https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.go go v. 1.18.1 支持
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.当我查看 chrome 开发工具并尝试打开链接时,我只是得到 (failed).net:ERR_CONNECTION_RESET。 "Failed to load response data: No Resource with given identifier found"
“无法加载响应数据:找不到具有给定标识符的资源”
Potential Issues:潜在问题:
Some Potential Next Steps:一些潜在的后续步骤:
I tried to replicate your issue using your code, but everything is fine .我尝试使用您的代码复制您的问题,但一切都很好。 My EB environment works and deploys perfectly with your code.
我的 EB 环境可以与您的代码完美配合和部署。
The only thing I can think of is that I used linux to create my binary, while you've used windows/amd64
.我唯一能想到的是我使用 linux 来创建我的二进制文件,而您使用的是
windows/amd64
。 I don't think those binaries are interchangeable.我不认为这些二进制文件是可以互换的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.