How to execute commands on AWS Instance using Boto3
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can anyone tell me if we can execute Shell Commands using Boto3 on Launched AWS instance. I read at few places about "boto.manage.cmdshell" but it is deprecated in Boto3. Appreciate any help. Regards, Saurabh 回答1: ssm_client = boto3.client('ssm') response = ssm_client.send_command( InstanceIds=['i-03#####'], DocumentName="AWS-RunShellScript", Parameters={'commands': ['start ecs']}, ) command_id = response['Command']['CommandId'] output = ssm_client.get_command_invocation( CommandId=command_id, InstanceId='i-03######', ) print(output) 回答2: No