DEV Community 👩‍💻👨‍💻

Rahul Wagh
Rahul Wagh

Posted on • Originally published at

Terraform how to SSH into AWS EC2 instance? - Part 10

Terraform SSH into EC2 instance instruction guide? -
How to handle SSH keys in AWS? -

While working with the AWS EC2 instance you do not get a Username and password to SSH into your EC2 instance. You have to either generate the SSH keys and associate the public key with the EC2 instance. After that, you need to use your private key to SSH into the virtual machine running in the AWS cloud.

On similar lines, if you are using Terraform to provision your AWS infrastructure you need to associate the public key with your terraform script and after starting the EC2 instance you need to use your private key to SSH into the EC2 instance.

In this lab session, we are going to perform the following steps -

  1. Generate key-pair(public key, private key) using ssh-keygen
  2. Use public key to start EC2 instance
  3. Use the private key to SSH into EC2 instance

Top comments (0)

The Complete Guide to Full Stack Web3 Development

The most important tools, protocols, and frameworks for building full stack web3 apps, and most importantly - how to put everything together to lay the groundwork for building out any of your own ideas in the future.