I'm having difficulty figuring out a way (if possible) to create a new AWS keypair with the Python Boto library and then download that keypair.
I'm having difficulty figuring out a way (if possible) to create a new AWS keypair with the Python Boto library and then download that keypair.
Same for Boto3:
ec2 = boto3.resource('ec2')
keypair_name = 'my_key'
new_keypair = ec2.create_key_pair(KeyName=keypair_name)
with open('./my_key.pem', 'w') as file:
file.write(new_keypair.key_material)
print(new_keypair.key_fingerprint)