sendSshPublicKey
inline suspend fun Ec2InstanceConnectClient.sendSshPublicKey(crossinline block: SendSshPublicKeyRequest.Builder.() -> Unit): SendSshPublicKeyResponse
Pushes an SSH public key to the specified EC2 instance for use by the specified user. The key remains for 60 seconds. For more information, see Connect to your Linux instance using EC2 Instance Connect in the Amazon EC2 User Guide.
Samples
fun main() {
//sampleStart
// The following example pushes a sample SSH public key to the EC2 instance i abcd1234 in AZ us west 2b
// for use by the instance OS user ec2 user.
val resp = ec2InstanceConnectClient.sendSshPublicKey {
instanceId = "i-abcd1234"
instanceOsUser = "ec2-user"
sshPublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3FlHqj2eqCdrGHuA6dRjfZXQ4HX5lXEIRHaNbxEwE5Te7xNF7StwhrDtiV7IdT5fDqbRyGw/szPj3xGkNTVoElCZ2dDFb2qYZ1WLIpZwj/UhO9l2mgfjR56UojjQut5Jvn2KZ1OcyrNO0J83kCaJCV7JoVbXY79FBMUccYNY45zmv9+1FMCfY6i2jdIhwR6+yLk8oubL8lIPyq7X+6b9S0yKCkB7Peml1DvghlybpAIUrC9vofHt6XP4V1i0bImw1IlljQS+DUmULRFSccATDscCX9ajnj7Crhm0HAZC0tBPXpFdHkPwL3yzYo546SCS9LKEwz62ymxxbL9k7h09t"
availabilityZone = "us-west-2a"
}
//sampleEnd
}