AWS EC2 passwordless ssh - key management/sharing best practices

I am setting up an MPI cluster and need to setup passwordless ssh between the head node and all the compute nodes.

I have learned about aws_security_group_rule via this article so I believe the ports are fine.

I am hoping to find information about Terraform way (best practice) to manage ssh keys for passwordless access between instances. Should I be doing all the setup via “user_data”


I would use the user_data for configuration, yes. And leave the key_name parameter for admin access.

And of course, the compute nodes would be an autoscaling group.