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.
2
Answers
I suggested by Mr. Paolo user-data is the way to go.
Your final user-data script will look like this:
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.
I would do it differently… I would create a custom AMI first with password authentication, and then launch this ami as any other instance. Only in the unique situation when it is not possible, I would go with
sed
=> restart route