无法使用CRON将文件从服务器上传到S3存储桶
下午好,您能把明智的眼睛和大脑在这个问题上投下吗?我应该使用AWS CLI设置一个计划上传的上传,以便我创建的CRON作业文件,也将发送到S3(每小时),也更早创建。现在,我已经使用了本指南,创建的脚本文件如下所示,其中本地文件夹路径是我的cron作业文件所在的位置,而存储桶名是我创建的(已通过CLI使用基本命令创建,尚未添加任何权限或策略)。这被保存为脚本。 >
有人可以建议我在哪里做嘘吗?它不是完全配置的S3吗?是否不正确地命名和/或将FIELS放置在服务器上的目录中?应该将第一个文件发送到S3的CRON作业是0 */1 * * */path to-script-file.script.sh
非常感谢您的帮助,我真的会喜欢正确地理解这里发生的事情。
脚本文件包含:
#!/bin/bash
aws s3 cp /local-folder-path/ s3://bucket-name
Good afternoon, can you cast your wise eyes and brains on this issue. I'm supposed to set up a scheduled upload using AWS CLI so that cron job file that I have created, gets sent to s3 (every hour), also created earlier. Now, I have used this guide, created script file as per below, where local folder path is where my cron job file is sitting and bucket-name is my bucket created (has been created via CLI with basic command, have not added any permissions or policies). This was saved as script.sh and since creating it, I have received 2 mails to my ec2-user with main error saying /bin/sh: /home/ec2-user/script.sh: Permission denied
Can someone advise on where am I making boo boo? Is it not fully configured S3? Is it incorrect naming and/or placing of the fiels in the directories on the server? Cron job that is supposed to be sending first file to s3 is 0 */1 * * * /path-to-script-file.script.sh
Thank you very much for the help, I would really like to get this right and understand what is happening here.
Script file contains:
#!/bin/bash
aws s3 cp /local-folder-path/ s3://bucket-name
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保将脚本运行为
ec2-user
,并且不要忘记chmod 755 Path/to/to/your/script
it。另外,您应该在
ec2-user
下运行cron
- 使用并尝试重新运行脚本。
最后,确保您的EC2具有正确的作用,可以写给S3。
Make sure you're running the script as
ec2-user
and don't forget tochmod 755 PATH/TO/YOUR/SCRIPT
it.Also, you should run the
cron
underec2-user
- useAnd try re-running the script.
Finally, make sure that your EC2 has the right role to write to S3.