github.com/armen/terraform@v0.5.2-0.20150529052519-caa8117a08f1/website/source/docs/providers/aws/r/key_pair.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_key_pair" 4 sidebar_current: "docs-aws-resource-key-pair" 5 description: |- 6 Provides a Key Pair resource. Currently this supports importing an existing key pair but not creating a new key pair. 7 --- 8 9 # aws\_key\_pair 10 11 Provides an [EC2 key pair](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) resource. A key pair is used to control login access to EC2 instances. 12 13 Currently this resource only supports importing an existing key pair, not creating a new key pair. 14 15 When importing an existing key pair the public key material may be in any format supported by AWS. Supported formats (per the [AWS documentation](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#how-to-generate-your-own-key-and-import-it-to-aws)) are: 16 17 * OpenSSH public key format (the format in ~/.ssh/authorized_keys) 18 * Base64 encoded DER format 19 * SSH public key file format as specified in RFC4716 20 21 ## Example Usage 22 23 ``` 24 resource "aws_key_pair" "deployer" { 25 key_name = "deployer-key" 26 public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" 27 } 28 ``` 29 30 ## Argument Reference 31 32 The following arguments are supported: 33 34 * `key_name` - (Required) The name for the key pair. 35 * `public_key` - (Required) The public key material. 36 37 ## Attributes Reference 38 39 The following attributes are exported: 40 41 * `key_name` - The key pair name. 42 * `fingerprint` - The MD5 public key fingerprint as specified in section 4 of RFC 4716.