Reputation: 11
This problem is driving me crazy, when I tested my codeigniter applicacion in local server everything was ok then I uploaded it in AWS EC2 (Ubuntu server) but when I try to upload a Image to AWS S3 from AWS EC2, I get a error 500. I use the library https://github.com/psugand/CodeIgniter-S3, somebody have used aws s3 and aws ec2 with a codeigniter app, I need its advice.
the error appear when this code is run:
$this->load->library('s3');
$this->s3->putObject($this->s3->inputFile($file,false),
$Bucket,
$name,
self::ACL_PUBLIC_READ);
I think that codeigniter is not connecting with AWS S3.
Thank you
Upvotes: 1
Views: 567
Reputation: 494
All this is happening due to permissions issues make sure that all the permissions must be 755 for the files in server for changing permission you must use
this is for the single file
chmod 755 ./name/of/file
and this is to change multiple files or all files in a folder
chmod 755 -R /folderlocation/andname
and if permission denied use sudo
Upvotes: 1
Reputation: 344
What is the bucket policy you have currently set with S3? Are you using separate IAM accounts that may be conflicting from a local environment to your Cloud environment (access keys, permissions etc.)
If you're able to (very) temporarily remove security restrictions until you're able to have a successful connection you will be able to nail down exactly what's causing your errors. You can then throw on the levels of security you personally define and find the problem (I'd put a bet on Bucket Policies)
If you've launched into a VPC you may also have issues with your instances being internet-routable, is this a new environment within AWS?
Upvotes: 0