【发布时间】:2021-07-04 22:37:15
【问题描述】:
我的 ec2 实例中有一个 shell 脚本,其中包含以下命令
#!/bin/bash
sleep 30
aws s3 sync s3://fbt-pano-input /home/ubuntu/pano/Zip
python3 pano.py
当我直接从实例运行这个 shell 脚本时,它会正确执行。但是,我的实例用户数据应该运行这个 shell 脚本。当它尝试运行它时,它会给出以下错误 致命错误:无法找到凭据
似乎无法运行同步命令从存储桶下载项目。我需要提供特殊访问权限吗?几个小时前它似乎工作正常。现在突然找不到凭据了。
这是我的用户数据代码
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/sh
cd /home/ubuntu
sh ./panorama.sh
我的 aws 配置具有正确的凭据。为什么会报错
【问题讨论】:
标签: python amazon-web-services amazon-s3 amazon-ec2