import boto3
client = boto3.client('ssm', region_name='us-east-1')
response = client.send_command(
InstanceIds=['i-xxxxxxx'],
DocumentName="AWS-RunShellScript",
Parameters={'commands': ['ls']}
)
print(response)
如果以上步骤不能解决问题,可以考虑使用 AWS SSM Run Command 或 AWS Systems Manager Session Manager 进行远程访问和管理。