Lightsail launch script breaks instance

0

As per title, every lightsail instance created with a launch script are broken.

SSH will not set up correctly, even with my key I'll get denied, so I can't see where did it go wrong.

Is there a specific way to exit the script? Should I not include a shebang? If so, which shell is used during lightsail setup?

Here's what my script looks like:

#!/bin/bash

exec &>> '/tmp/launch.log'

tmp_dir="$(mktemp -d)"
cd "$tmp_dir" || exit 1

## dnf install epel-release
## Install a bunch of other packages
## Also grabs configuation files
## Plus SELinux contexts

logger -t launch_log < '/tmp/launch.log'
exit
질문됨 한 달 전256회 조회
2개 답변
0

Hello.

I recommend that you create a snapshot of the root volume using the steps in the document below, mount it on a healthy Lightsail, and then check the system logs, etc.
https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-create-an-instance-root-volume-snapshot.html

Looking at the shell script, most of it is commented out, so it appears that no commands that affect SSH are executed.
Can I access it via a browser using the steps in the document below?
https://docs.aws.amazon.com/lightsail/latest/userguide/lightsail-how-to-connect-to-your-instance-virtual-private-server.html

profile picture
전문가
답변함 한 달 전
0

Hi,

Your instance should be accessible using Lightsail Connect or terminal-based SSH and the SSH key selected during instance creation. If you can connect to your instance, you can view the execution output of the provided userdata script at /var/log/cloud-init-output.log to help with debugging.

If you cannot connect to your instance, I recommend creating a root volume snapshot and attaching it to a known working instance you can connect to and inspect the cloud-init output.

AWS
jscta
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠