runway.cfngin.hooks.keypair module¶
AWS EC2 keypair hook.
-
runway.cfngin.hooks.keypair.
import_key_pair
(ec2, keypair_name, public_key_data)[source]¶ Import keypair.
-
runway.cfngin.hooks.keypair.
create_key_pair_from_public_key_file
(ec2, keypair_name, public_key_path)[source]¶ Create keypair from public key file.
-
runway.cfngin.hooks.keypair.
create_key_pair_in_ssm
(ec2, ssm, keypair_name, parameter_name, kms_key_id=None)[source]¶ Create keypair in SSM.
-
runway.cfngin.hooks.keypair.
create_key_pair_local
(ec2, keypair_name, dest_dir)[source]¶ Create local keypair.
-
runway.cfngin.hooks.keypair.
ensure_keypair_exists
(provider, context, **kwargs)[source]¶ Ensure a specific keypair exists within AWS.
If the key doesn’t exist, upload it.
- Parameters
provider (
runway.cfngin.providers.base.BaseProvider
) – Provider instance. (passed in by CFNgin)context (
runway.cfngin.context.Context
) – Context instance. (passed in by CFNgin)
- Keyword Arguments
keypair (str) – Name of the key pair to create
ssm_parameter_name (Optional[str]) – Path to an SSM store parameter to receive the generated private key, instead of importing it or storing it locally.
ssm_key_id (Optional[str]) – ID of a KMS key to encrypt the SSM parameter with. If omitted, the default key will be used.
public_key_path (Optional[str]) – Path to a public key file to be imported instead of generating a new key. Incompatible with the SSM options, as the private key will not be available for storing.
- Returns
In case of failure
False
, otherwise a dict containing:- status (str):
Ene of
exists
,imported
orcreated
.- key_name (str):
Name of the key pair.
- fingerprint (str):
Fingerprint of the key pair.
- file_path (Optional[str]):
If a new key was created, the path to the file where the private key was stored.
- Return type