# Pastebin 0F0aDxGa -- Set wget command. Note that wget is busybox wget because this needs -- to run in initramfs. # wgetCmd="wget --header 'X-aws-ec2-metadata-token: $TOKEN'" # $wgetCmd -O "$metaDir/ami-manifest-path" $imds/meta-data/ami-manifest-path wget: bad address 'TOKEN-REDACTED'' -- Okay, what did it try to run? # echo $wgetCmd -O "$metaDir/ami-manifest-path" $imds/meta-data/ami-manifest-path wget --header 'X-aws-ec2-metadata-token: TOKEN-REDACTED' -O ./ami-manifest-path http://169.254.169.254/2009-04-04/meta-data/ami-manifest-path -- Let's paste that into the terminal. It works! # wget --header 'X-aws-ec2-metadata-token: TOKEN-REDACTED' -O ./ami-manifest-path http://169.254.169.254/2009-04-04/meta-data/ami-manifest-path -- Okay, what is the value of that variable? # declare -p wgetCmd declare -- wgetCmd="wget --header 'X-aws-ec2-metadata-token: AQAEAGj2do44xgblZt4YiC2TA7T0xpfRXYO32BeA5D7obSKrdoQXfA=='"