I am making a Cron Job in AWS Server and I have this File Handling function which creates JSON file. I already have Amazon S3 Cloud Storage, and I want my JSON file saved inside it. How can I do it? I tried to locate the directory for Amazon S3 Storage using Filezilla but found nothing. Thank you!
Asked
Active
Viewed 47 times
1 Answers
1
you have to put another command into your cron.
After you create a Json file, you have to use awscli to upload your json to S3 storage.
Here is how to install it.
after its set up, you can use aws s3 command to upload it.
have a look here for more information.
I guess this this a command you need to add.
aws s3 cp ./yourfile.json s3://your-bucket-name/

Natsathorn
- 1,530
- 1
- 12
- 26
-
naah.. it didn't sorry. I want it to run together with cron, so my project will save the JSON file to my s3 bucket automatically. I also tried shell_exec() inside the cron function but it seems like the 'aws s3' command not found. – Imperatura Jul 17 '18 at 09:57
-
have you install `aws-cli` – Natsathorn Jul 17 '18 at 10:13
-
yes @Natsathorn, i can run aws command using terminal but when i try to do it in shell_exec() or exec() it returns error – Imperatura Jul 18 '18 at 04:27
-
it says aws not found – Imperatura Jul 18 '18 at 08:59
-
have a look here https://stackoverflow.com/questions/26480860/aws-not-working-working-from-cronjob – Natsathorn Jul 18 '18 at 09:03
-
Will mark your answer green if it will work, i have other things to get done and i will come back to this. :) thank you! – Imperatura Jul 19 '18 at 09:15