pem_file#

AWS recommend to use Pem file to SSH to EC2 instance.

This module follows some convention to locate the pem file.

Reference:

class ssh2awsec2.pem_file.PemFileStore(dir_pem_files: pathlib.Path = PosixPath('/home/docs/ec2-pem'))[source]#
get_pem_file_path(account_id_or_alias: str, region: str, key_name: str) Path[source]#

The convention is to put the pem file at ${dir_root}/${account_id_or_alias}/${region}/${key_name}.pem.

locate_pem_file(region: str, key_name: str, account_id: Optional[str], account_alias: Optional[str])[source]#

Try to locate the EC2 pem file at ${HOME}/${account_id_or_alias}/${region}/${key_name}.pem

Parameters:
  • region

  • key_name

  • account_id

  • account_alias