DEV Community

Rahul Wagh
Rahul Wagh

Posted on • Originally published at jhooq.com

1

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

Terraform SSH into EC2 instance instruction guide? - https://jhooq.com/terraform-ssh-into-aws-ec2/
How to handle SSH keys in AWS? - https://youtu.be/S5B09dq-jGQ

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

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay