Comments (7)
This works for me.
require 'rubygems'
require 'aws/s3'
s3 = AWS::S3.new(
:access_key_id => "KEY",
:secret_access_key => "SECRET",
:s3_endpoint => 'localhost',
:s3_port => '10003',
:use_ssl => false,
)
bucket = s3.buckets['Bucket1']
obj = bucket.objects['key']
obj.write(File.open('/some/file/name/here'))
puts bucket.objects['key'].read
from fake-s3.
I was using this http://aws.amazon.com/sdkfornodejs/
I ran this command line in Windows 7
C:\s3>fakes3 -r c:\s3 -p 4567
Loading FakeS3 with c:/s3 on port 4567 with hostname s3.amazonaws.com
[2014-03-06 13:07:26] INFO WEBrick 1.3.1
[2014-03-06 13:07:26] INFO ruby 1.9.3 (2012-11-10) [i386-mingw32]
[2014-03-06 13:07:26] INFO WEBrick::HTTPServer#start: pid=8104 port=4567
My code is this:
var AWS = require('aws-sdk');
var s3 = new AWS.S3({
access_key_id: "KEY",
secret_access_key: "SECRET",
s3_endpoint: 'localhost',
s3_port: '4567',
use_ssl: false}
);
s3.createBucket({Bucket: 'myBucket'}, function() {
var params = {Bucket: 'myBucket', Key: 'myKey', Body: 'Hello!'};
s3.putObject(params, function(err, data) {
if (err)
console.log(err)
else
console.log("Successfully uploaded data to myBucket/myKey");
});
});
And I got error as below. Any help?
{ [CredentialsError: Could not load credentials from any providers]
message: 'Could not load credentials from any providers',
code: 'CredentialsError',
errno: 'ENETUNREACH',
syscall: 'connect',
time: Thu Mar 06 2014 16:14:33 GMT-0800 (Pacific Standard Time),
originalError:
{ code: 'ENETUNREACH',
errno: 'ENETUNREACH',
syscall: 'connect',
message: 'connect ENETUNREACH' },
_willRetry: false }
from fake-s3.
I am too having this problem. How can I fix it? ^ I've tried adding the missing "credentials".
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var accessKeyId = process.env.AWS_ACCESS_KEY || "accesskey";
var secretAccessKey = process.env.AWS_SECRET_KEY || "secretkey";
AWS.config.update({
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey,
region: 'us-west-1' // Missing? I never had to specify this before
});
from fake-s3.
@quanghoc @georgeportillo and for anyone else using the aws-sdk-js library. This is working for me:
var config = {
accessKeyId: "123",
secretAccessKey: "abc",
endpoint: "localhost:3001",
sslEnabled: false,
s3ForcePathStyle: true
};
AWS.config.update(config);
var s3 = new AWS.S3({params: {Bucket: 'myBucket'}});
from fake-s3.
This error occurs when you pass in invalid credentials.
from fake-s3.
Closing because it seems this has been resolved - invalid credentials was the problem. If it wasn't, just let me know exactly what I should do to reproduce and I can look into it.
from fake-s3.
Just had the same thing, My uploaded content would be available like normal, but as soon as i would use the aws-sdk to manipulate files i would receive the same ENETUNREACH error. The whole day looking for a problem. Next day it magically started working again. Turns out that it was a problem with amazon.
Intresting...
from fake-s3.
Related Issues (20)
- [Feature] Add support of payer option, to allow usage with ansible s3_bucket library
- fakes3 error
- [Bug] Error message "undefined method `gsub' for nil:NilClass" when attempting to store something.
- [Bug] Multipart Upload Fails for Large Files
- Incorrect behavior when using Prefix HOT 1
- [Other] LoadError: load error: jopenssl/load -- java.lang.IncompatibleClassChangeError: Implementing class
- [Bug] X-Amz-Content-Sha256 is not allowed for upload
- [Feature] Multipart upload more descriptive error message for uploading one part HOT 2
- License timebomb should be a major version HOT 3
- [Question] Next release? HOT 1
- [Feature] Support GET Bucket requestPayment
- [QUESTION] Where I can find the CI service? HOT 1
- [Bug] Deleting "fake" directories
- [Bug] Licensing does not work for certain valid email addresses HOT 5
- [Bug] Cannot upload files with size > 2GB
- [Question]: Are files actually created when uploading or is file creation simulated?
- [Bug] Prevent directory traversal
- "rake test_sever" not working in windows. is there any way to resolve this ? HOT 1
- Ruby 3.1 compatibility HOT 1
- [Feature] Support for AWS v3 SDK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fake-s3.