FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

aws_key_pair

Provides an EC2 key pair resource. A key pair is used to control login access to EC2 instances.

Currently this resource only supports importing an existing key pair, not creating a new key pair.

When importing an existing key pair the public key material may be in any format supported by AWS. Supported formats (per the AWS documentation) are:

Example Usage

resource "aws_key_pair" "deployer" {
  key_name = "deployer-key" 
  public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 [email protected]"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

Key Pairs can be imported using the key_name, e.g.

$ terraform import aws_key_pair.deployer deployer-key

See the source of this document at Terraform.io