从EC2实例自动填充RDP文件并将密码放入剪贴板
ec2rdp的Python项目详细描述
摘要
用于解密 aws ec2 windows实例,将解密的密码放入 剪贴板并编写一个rdp文件来访问aws EC2 Windows实例。
安装
pip install ec2rdp
用法
ec2rdp [-h] [-o OUTPUT] [-k KEY] [-q] [--aws-profile AWS_PROFILE] [--aws-access-key-id AWS_ACCESS_KEY_ID] [--aws-secret-access-key AWS_SECRET_ACCESS_KEY] [--aws-region AWS_REGION] instance-id positional arguments: instance-id The instance-id to decrypt the password. optional arguments: -h, --help show this help message and exit -o OUTPUT, --output OUTPUT The path for the rdp file to be created. -k KEY, --key KEY The path to the private key file to decrypt the password. -q, --quick The script will not ask for the passphrase for the key file. --aws-profile AWS_PROFILE The profile name for aws credentials --aws-access-key-id AWS_ACCESS_KEY_ID The access key id for aws --aws-secret-access-key AWS_SECRET_ACCESS_KEY The secret access key for aws --aws-region AWS_REGION The region for aws
AWS证书
脚本将在以下位置查找AWS的凭据:
- AWS_PROFILE环境变量,其凭据设置为~/.aws/credentials或~/.aws/config。使用此选项时,必须设置--aws-region,~/.aws/config必须包含配置文件的区域值,或者必须设置AWS_DEFAULT_REGION。
- AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY环境变量。使用时,必须设置--aws-region或AWS_DEFAULT_REGION。
- --aws-profile命令行选项。使用此选项时,必须设置--aws-region,~/.aws/config必须包含配置文件的区域值,或者必须设置AWS_DEFAULT_REGION。
- --aws-access-key-id,--aws-secret-access-key命令行选项。使用时,必须设置--aws-region或AWS_DEFAULT_REGION。
输入aws配置文件
如果对配置文件中可用的所有aws ec2 windows实例使用相同的键,则可以将路径设置为 ~/.aws/config文件中的密钥文件。为此,添加一个ec2rdp_key条目,该条目的路径是 个人资料。
示例:
[profile profile1] output = json region = us-west-1 ec2rdp_key = ~/keys/profile1.pem