I need to ssh into EC2 instance using terraform. How to generate ssh keys and lo . . .

Ashok kumar B:
I need to ssh into EC2 instance using terraform. How to generate ssh keys and login in into ec2 instance. I don’t want to use existing keys. I need to generate keys store it into a file and attach public keys to ec2 machine.how to achieve this ?

Mohamed Ayman:
you can use ur own key like this https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/key_pair and call it in ur ec2 resource