aws ssm
参考:https://docs.aws.amazon.com/zh_cn/systems-manager/latest/userguide/walkthrough-cli.html
- 显示实例是否处于联机状态
aws ssm describe-instance-information --output text --query "InstanceInformationList[*]"
- 获取实例的 IP 信息
# aws ssm send-command --instance-ids "xxx" --document-name "AWS-RunShellScript" --comment "IP config" --parameters commands=ifconfig --output text
An error occurred (InvalidInstanceId) when calling the SendCommand operation
# systemctl status amazon-ssm-agent
正常日志:[HealthCheck] HealthCheck reporting agent health.
异常日志:ERROR Health ping failed with error - NoCredentialProviders: no valid providers in chain. Deprecated.
解决
选中实例 -> 操作 -> 实例设置 -> 附加/替换 IAM 角色
IAM 角色要求的权限策略
AmazonEC2RoleforSSMAmazonS3FullAccessAmazonSSMAutomationRole