Hey everyone, does anyone know if there's a way to...
# aws
p
Hey everyone, does anyone know if there's a way to create an ec2 KeyPair without specifying the public key using pulumi, similar to how you would in the AWS CLI or AWS console? It's currently required for the the pulumi_aws.ec2.KeyPair object to take in a public_key. https://www.pulumi.com/docs/reference/pkg/aws/ec2/keypair/
l
It isn't possible. If the cli or console allows it, it's because they create the key in the background for you and just hide that bit. Creating a key in Pulumi is trivial. One line:
Copy code
const tlsKey = new tls.PrivateKey(name, { algorithm: "RSA" });
An EC2 KeyPair is a simple wrapper around a public key. There must be a public key to wrap, in order to have a key pair. It is an odd name though, since it isn't a pair of keys. It's a single key, the public half of a public/private key pair.
❤️ 1
p
Okay I'll give it a go thanks a lot! 😄
l
👍 You'll need to export the key's private pem value to decode the auto-generated password for the default user (.\Administrator or similar). You might not need this if you join the machine to a Windows domain, or some other authentication service.