让 SSM 启动会话使用 bash

Have SSM start-session use bash

我正在使用 AWS Simple Session Manager 和 AWS CLI 通过 SSH 连接到实例。当我调用 aws ssm start-session --target INSTANCE_ID 时,它会在服务器上启动 sh,而不是 bash。有什么方法可以自定义实例启动时 运行 的命令吗?

您可以使用 AWS 提供的配置文档来完成,如下所示:

aws ssm start-session --target INSTANCE_ID --document-name AWS-StartInteractiveCommand --parameters command="bash -l"

来源:a github issue on the topic