amazon-s3

S3 Java client fails a lot with “Premature end of Content-Length delimited message body” or “java.net.SocketException Socket closed”

喜欢而已 提交于 2020-01-12 03:14:11
问题 I have an application that does a lot work on S3, mostly downloading files from it. I am seeing a lot of these kind of errors and I'd like to know if this is something on my code or if the service is really unreliable like this. The code I'm using to read from the S3 object stream is as follows: public static final void write(InputStream stream, OutputStream output) { byte[] buffer = new byte[1024]; int read = -1; try { while ((read = stream.read(buffer)) != -1) { output.write(buffer, 0, read

EC2 or S3 to host AngularJS app?

自古美人都是妖i 提交于 2020-01-12 01:54:50
问题 I want to launch a production version of an AngularJS application, and I find Amazon AWS to be an awesome hosting suite. As AngularJS is essentially static it could be hosted on S3 storage, or on an EC2 server with node.js backend. Either of these solutions would suit my deployment method, so the question is, will I (in theory) get better performance from one or the other, and why? Is there anything wrong with hosting a professional website frontend on S3? Does anyone have any experience with

How do I delete an object on AWS S3 using Javascript?

点点圈 提交于 2020-01-11 19:58:17
问题 I want to delete a file from Amazon S3 using Javascript. I have already uploaded the file using Javascript. Any ideas? 回答1: You can use the JS method from S3: var AWS = require('aws-sdk'); AWS.config.loadFromPath('./credentials-ehl.json'); var s3 = new AWS.S3(); var params = { Bucket: 'your bucket', Key: 'your object' }; s3.deleteObject(params, function(err, data) { if (err) console.log(err, err.stack); // error else console.log(); // deleted }); Be aware that S3 never returns it the object

How do I delete an object on AWS S3 using Javascript?

不羁岁月 提交于 2020-01-11 19:58:13
问题 I want to delete a file from Amazon S3 using Javascript. I have already uploaded the file using Javascript. Any ideas? 回答1: You can use the JS method from S3: var AWS = require('aws-sdk'); AWS.config.loadFromPath('./credentials-ehl.json'); var s3 = new AWS.S3(); var params = { Bucket: 'your bucket', Key: 'your object' }; s3.deleteObject(params, function(err, data) { if (err) console.log(err, err.stack); // error else console.log(); // deleted }); Be aware that S3 never returns it the object

Django Storage Backend for S3

风格不统一 提交于 2020-01-11 19:56:22
问题 I'm looking for a good Django custom storage backend for use with Amazon S3. I've been googling around and found a lot of blog posts with code snippets or half-baked gist.github.com one-off jobs. But I can't seem to find a solid, well-tested one. Is there a widely accepted standard Amazon S3 Django custom storage backend out there? It doesn't particularly matter to me what Python backend library it uses--i.e., either S3.py or boto are fine. 回答1: Have you checked out django-storages? I would

Amazon S3 Url rewrite [closed]

限于喜欢 提交于 2020-01-11 15:30:35
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . How can I change the Amazon S3 url from http://bucket.amazons3.com/imagepath.jpg to http://image.mydomain.com/imagepath.jpg EDIT: Basically the whole reason for this is to hide the amazon s3 url from my users. I was thinking about a HttpModule that would redirect the request from image.mydomain.com to bucket

Deleting file from S3 bucket in iOS app (Swift)

南笙酒味 提交于 2020-01-11 11:39:07
问题 I am writing an iOS app in Swift, and am using Amazon S3 to store files. I was wondering if anyone knows how I can programmatically delete files in my S3 bucket on command (instead of setting a delete policy in the bucket lifecycle). Thanks in advance 回答1: Your code to delete a file from S3 bucket should look something like this: let s3 = AWSS3.defaultS3() let deleteObjectRequest = AWSS3DeleteObjectRequest() deleteObjectRequest.bucket = "yourBucketName" deleteObjectRequest.key = "yourFileName

How to Rename or Copy Files on AWS Lambda function?

Deadly 提交于 2020-01-11 10:15:33
问题 I am a bit new to AWS / Lambda from the technical side so I have a scenario adn I wanted your help. I have a file that drops daily, I only care about the file on the last day of the month. They all drop to the same bucket the file drops at 8 EST. I then need to rename the file from the last day of the month to a static name, and copying it to a bucket lets say the file is called bill. I would want the previous file there called bill_september if we are in october. So my thought is to have a

Upload a file to AWS S3 pre-signed URL using Retrofit2

对着背影说爱祢 提交于 2020-01-11 10:01:47
问题 I'm trying to upload a file to Amazon's S3 using a pre-signed URL. I get the URL from a server which generates the URL & sends it to me as part of a JSON object. I get the URL as a String, something like this: https://com-example-mysite.s3-us-east-1.amazonaws.com/userFolder/ImageName?X-Amz-Security-Token=xxfooxx%2F%2F%2F%2F%2F%2F%2F%2F%2F%2Fxxbarxx%3D&X-Amz-Algorithm=xxAlgoxx&X-Amz-Date=20170831T090152Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=xxcredxx&X-Amz-Signature

AWS S3 Java: doesObjectExist results in 403: FORBIDDEN

感情迁移 提交于 2020-01-11 07:29:06
问题 I'm having trouble with my Java program using the AWS SDK to interact with an S3 bucket. This is the code I use to create an S3 client: public S3StorageManager(S3Config config) throws StorageException { BasicAWSCredentials credentials = new BasicAWSCredentials(myAccessKey(), mySecretKey()); AWSStaticCredentialsProvider provider = new AWSStaticCredentialsProvider(credentials); this.s3Client = AmazonS3ClientBuilder .standard() .withCredentials(provider) .withRegion(myRegion) .build(); When I