1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
You can absolutely do this.
First, create the keypair: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html
Then, when you are creating the instance you can reference the keypair: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-instance.html#cfn-ec2-instance-keyname
Edit (adding further details based on comment below): In the documentation on the page linked above it says this about downloading the newly created keypair:
When you create a new key pair, the private key is saved to AWS Systems Manager Parameter Store, using a parameter with the following name:
/ec2/keypair/{key_pair_id}
Contenus pertinents
- demandé il y a un an
- demandé il y a un an
- demandé il y a 2 mois
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 4 mois
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 2 ans
Thank you,{ "Resources": { "NewKeyPair": { "Type": "AWS::EC2::KeyPair", "Properties": { "KeyName": "MyKeyPair" } }, "Ec2Instance": { "Type": "AWS::EC2::Instance", "Properties": { "ImageId": "ami-02b92c281a4d3dc79", "KeyName": { "Ref": "NewKeyPair" } } } } } With above example, how can we download .pem file to connect to instance after launch? I found this example: