'AWS User Data Script - Dependency Installation Failure
I have a simple user_data script that I am applying to am aws_launch_template inside of a terraform module.
resource "aws_launch_tempalte "host" {
...
user_data = filebase64(".../install_python.sh")
}
My starting point was a very simple script that only apply a system update and installed python3 onto the host.
#!/bin/bash
dnf update -y
dnf install -y python3
My goal is to add additional dependencies (git, docker, kubectl, etc) in a similar fashion, but for some reason, my user data script fails to run at all as soon as I add another command.
For example, if I just append dnf install -y git to the above script, it's as if the script fails to run at all. NOTE: the script successfully installs python3 before making this addition.
Question is 1. Why? and 2. What's the best way to view the log output of the user_data scripts via AWS and from within the box itself?
Thanks everyone!
---EDIT---
So I had a list of several dependencies in this script, each install was marked with a comment that explained the justification for each dep. Once I removed the comments, the user_data script executed properly. Any reason why comments throughout the script would interfere?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
