Open cormip opened 7 years ago
I have the same code base on both an EC2 instance and a DigitalOcean droplet. Same AWS keys, same bucket, same METEOR_SETTINGS.
Slingshot.fileRestrictions( "uploadToAmazonS3", { allowedFileTypes: [ "image/png", "image/jpeg", "image/gif"], maxSize: 1 * 1024 * 1024 }); Slingshot.createDirective( "uploadToAmazonS3", Slingshot.S3Storage, { acl: "public-read", authorize: function () { //Deny uploads if user is not logged in. if (!this.userId) { const message = "Please login before posting files"; throw new Meteor.Error("Login Required", message); } return true; }, key: function ( file, metaContext ) { return metaContext.id + "/" + file.name; } });
Bucket Policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789123:user/my-app-dev" }, "Action": "s3:*", "Resource": [ "arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*" ] }, { "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::my-bucket/*" } ] }
Bucket CORS:
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>PUT</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>HEAD</AllowedMethod> <AllowedMethod>DELETE</AllowedMethod> <MaxAgeSeconds>3000</MaxAgeSeconds> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration>
The config is basically good because it works on the droplet. What would be different for the app originating on the EC2 instance instead?
I have the same code base on both an EC2 instance and a DigitalOcean droplet. Same AWS keys, same bucket, same METEOR_SETTINGS.
Bucket Policy:
Bucket CORS:
The config is basically good because it works on the droplet. What would be different for the app originating on the EC2 instance instead?