How do I create a CloudFormation stack that automatically stands-up an EC2 linux instance but the login to be made via a password and without any keys.
I found a tutorial to enable password authentication but It requires changing the data in sshd_config and restarting the instance and I’m not sure how to replicate that in an cloudformation stack.
>Solution :
I suggested by Mr. Paolo user-data is the way to go.
Your final user-data script will look like this:
#!/bin/bash
yum update -y
yum install -y httpd
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
systemctl restart sshd
This will make sure password auth is enabled once your system boots up and performs user data operations.
Learn more about user data over this link:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
Hope this helps. Thanks.