DEV Community

Super Kai (Kazuya Ito)
Super Kai (Kazuya Ito)

Posted on

Create a key pair and download the .pem file with Terraform (AWS)

I could create the key pair myKey to AWS with Terraform.

resource "tls_private_key" "pk" {
  algorithm = "RSA"
  rsa_bits  = 4096
}
resource "aws_key_pair" "kp" {
  key_name   = "myKey"       # Create a "myKey" to AWS!!
  public_key = tls_private_key.pk.public_key_openssh
}

AWS:

enter image description here

But I couldn't download the myKey.pem file. Is it…

Top comments (0)