gpt4 book ai didi

amazon-web-services - AWS EC2 用户数据脚本未按预期工作

转载 作者:行者123 更新时间:2023-12-05 00:45:53 24 4
gpt4 key购买 nike

当我 ssh 进入我的 EC2 实例并运行以下命令时,我的 SpringServer.jar 文件将执行,我可以通过转到 myawsaccount:8080/times 访问我的 Spring 应用程序.当我在用户数据中指定以下命令时,我无法在 myawsaccount:8080/times 访问我的应用程序,我不知道为什么。任何帮助将不胜感激。

命令

#!/bin/bash --> only in user script
sudo su

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm

yum install -y jdk-8u141-linux-x64.rpm

wget https://myawsaccount.s3-eu-west-1.amazonaws.com/SpringServer-1-0.0.1-SNAPSHOT.jar

java -jar SpringServer-1-0.0.1-SNAPSHOT.jar

最佳答案

解决问题 UserData问题,最好的办法是登录到一个实例,并检查 UserData 之一日志文件。

最无力/var/log/cloud-init-output.log :

The cloud-init output log file (/var/log/cloud-init-output.log) captures console output so it is easy to debug your scripts following a launch if the instance does not behave the way you intended.

还有你的UserData脚本将位于 /var/lib/cloud/instances/<instance-id>/ .因此,一旦您在实例中,您可以手动尝试运行它并在实例中修复/调试

关于amazon-web-services - AWS EC2 用户数据脚本未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62524748/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com