Just wanted to point out a couple issues/solutions when working through setup with the aws-alias.sh script. I am using an ubuntu shell w windows 10.
I’m using a free-tier t2 server (micro) and paid tier p2 server, with the plan to test small code on the free tier and pay the 90c/hour when I need to. The aws-alias.sh code references ‘t2.large’ large servers so this needed to be changed to ‘t2.micro’ in the code snippet.
for part 2) I had issues with the script, it turns out it wasnt the script but either windows invisible characters at the end or in the middle of file messing things up. i had copied and pasted from the Raw github file from windows into the cygwin editor.
i used cygwin to install dos2unix and then ran that command on the .sh file and after cleaning the file up no issues.
I was running into similar issue with all the variables assigned by Echo output and was not seeing the same issue in Win 10 with Linux. After spending more than 3 hours (definitely not deep learning I was able to identify the special character (^M obtained by doing Ctrl-V followed by Ctrl-M) and remove it using dos2unix and storing the output in the same variable. I had to modify the script before using $instanceId and $instanceIp . Also learnt that Linux is very sensitive to space after the assignment operator also and had to remove the space.
akrish5@AKRISH5-MOBL1 ~
$ echo $instanceIp | cat -A
35.166.8.45$
akrish5@AKRISH5-MOBL1 ~
$ ssh -i ~/.ssh/aws-key2.pem ubuntu@$instanceIp
The authenticity of host ‘35.166.8.45 (35.166.8.45)’ can’t be established.
ECDSA key fingerprint is SHA256:8CePDM/9EMM+g55CLSv6cZ8m/98wbk2ZF1sfW8LFeCw.
Are you sure you want to continue connecting (yes/no)?