Provisioning EC2 key pairs with terraform.

Please visit my website and subscribe to my youtube channel for more articles

https://devops4solutions.com/

In this blog, we will be Provisioning EC2 key pairs with terraform.

There are two ways to Provisioning EC2 key pairs with terraform

  1. Use Existing Key
  2. Create New Key

Use Existing Key

You can create one key using AWS console and use the existing one which is already present as shown below

Image for post
Image for post

Now in your terraform code, you have to just use this key name in your configuration like this

Create New Key

You can create a new key, you have to pass the public key as shown, you can use the path or hardcoded the public key .

Written by

Devops Automation Enginneer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store