Howdy I am trying to provision an ec2 instances wi...
# getting-started
g
Howdy I am trying to provision an ec2 instances with ssh. And I've done the pulumi set public/privatekeyPath. But When I check on AWS it gives me this error. This instance is not associated with a key pair. Without a key pair, you can't connect to the instance through SSH.
l
What is pulumi set public/privatekeyPath? To use SSH to connect to an EC2 instance, the property you need to configure is
keyName
. You also need an SSH daemon running on the EC2 instance, and you need to use the the private key on the machine you're connecting from.
g
do I need to do this?
cat my_key.pub | pulumi config set publicKey
l
No, I don't know what that is. It's not to do with AWS at all.
Unless you're implementing it yourself? Do you get that value from your config and make a keyPair from it?
g
I figured it out thank you.
l
Well done! Was it anything that future visitors might learn from?
g
The problem is, the example are unclear and confusing. The examples show to use pulumi config set. Also there is a SSHkey and Keypair, which I assume you can do the same thing with, but there isn't clear examples how this should be setup. Which is weird because usually all I have to do is go github and grab the example, and it mostly works. I could add my code to the repo if that would help
e
https://www.pulumi.com/docs/intro/concepts/config/#setting-and-getting-configuration-values
Copy code
If [value] is not specified when setting a configuration key, the CLI will prompt for it interactively. Alternatively, the value can be set from standard input, which is useful for multiline values or any value that must be escaped on the command line:

cat my_key.pub | pulumi config set publicKey
https://www.pulumi.com/registry/packages/aws/how-to-guides/aws-go-ansible-wordpress/#deploying-your-infrastructure
Copy code
Set the required configuration variables, choosing any valid AWS region. The code is written in such a way to work in any AWS region, including fetching the right Amazon Linux 2 AMI and availability zones:

pulumi config set aws:region us-east-1 # any valid AWS region

pulumi config set publicKeyPath wordpress-keypair.pub # your newly generated public key

pulumi config set privateKeyPath wordpress-keypair # your newly generated private key

pulumi config set dbPassword Sup45ekreT#123 --secret # your RDS database password -- keep it safe!
These sections are about the general mechanism to set a string value to Pulumi's config store (not sure what it should be called) so that your own Pulumi program can be implemented in such a way that it loads the string and sets it to AWS. They don't mean your SSH pub key will be sent to AWS directly/automatically
220 Views