Predix_Logo
  • Categories
    • Questions
    • Predix | Updates
      • Pricing
      • Product
    • Deloitte - Private
    • How-To
    • Accenture-Private
  • Explore
    • Topics
    • Questions
    • Articles
    • Feedback or Feature Requests
  • Sign in
  • Home /
  • Questions /
avatar image
0
Question by Lee Hayward · Jul 02, 2016 at 07:17 AM · blobstore-service

Blobstore Access Denied in node.js

Hi,

I have added created a blobstore instance and bound it to my nodeJS service. When I try and connect to blobstore, I get error 403 Access Denied. Code is

var AWS = require('aws-sdk')

AWS.config.update({accessKeyId: 'My Key', secretAccessKey: 'My Secret Key', region: 'us-west-2'})

var s3 = new AWS.S3()

s3.listBuckets(function (error, data) { if (error) { console.log('Error:', error) } })

Please note that MyKey and MySecretKey are taken from ENV in the real code. My nodeJS server is running in Cloud Foundry

From AWS documentation, the above code is basically what is needed, and should work. Can anyone please tell me why I cannot list the buckets please? I haven't created any new buckets myself, but ENV does list a bucket that was created for me

Comment
Add comment
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

  • Sort: 
avatar image
1
Best Answer

Answer by Lee Hayward · Jul 04, 2016 at 01:58 AM

I have figured out the problem. I do not have permission to list buckets - however, I have managed to create an object in my default bucket, and also to list all created objects.

According to AWS documentation, it says that had I created the bucket in raw S3, I could log into the AWS Management console (http://docs.aws.amazon.com/AmazonS3/latest/UG/EditingBucketPermissions.html) and edit accordingly.

Does anyone know if there is a Predix equivalent please (from Basic environment)?

Comment
Add comment · Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Beth Ekimoff · Jul 04, 2016 at 05:16 PM 0
Share

In both environments creating an instance correlates to one bucket and you only have access to perform object operations. To create another bucket you will need to create another instance.

avatar image Lee Hayward · Jul 05, 2016 at 12:11 AM 0
Share

Hi Beth

If I understand correctly, you are saying that the bucket created with the instance is the only bucket you can ever create in that instance? If so, why does the AWS-SDK have a function called listBuckets (pertaining to S3)?

If you can only create a single bucket in the instance, then this function seems moot

Lee

avatar image Brian Henzelmann Lee Hayward · Jul 05, 2016 at 05:30 AM 0
Share

The AWS SDK is designed for use with a normal S3 instance you can create through the AWS console. In Predix, you're given access to just one bucket per instance, so the list bucket function is moot.

avatar image Lee Hayward Brian Henzelmann · Jul 05, 2016 at 05:40 AM 0
Share

Perfect. That completes the answer to the original question

Thank-you

avatar image
0

Answer by Lee Hayward · Jul 03, 2016 at 02:06 PM

Hi Brian

The only URL provided is to the default bucket created. The host is s3-us-west-2.amazonaws.com, which is what I should connect to by setting the region in AWS.config (see http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-examples.html)

Taken from ENV (edited):

 "credentials": {
   "access_key_id": "My Key",
   "bucket_name": "bucket-abc123",
   "host": "s3-us-west-2.amazonaws.com",
   "secret_access_key": "My Secret KEY",
   "url": "https://bucket-abc123.s3-us-west-2.amazonaws.com"
 }

My code is hosted inside of Cloud Foundry

As far as I can tell, connecting to us-west-2, using the key and secret key should be enough to connect to my blobstore

Comment
Add comment · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Brian Henzelmann · Jul 03, 2016 at 12:16 PM

Are you specifying the url that's provided from the ENV variables? I think it's a 10.x IP, so you'll want to use that rather than point to the normal S3 url.

Otherwise, I wonder if the problem is because when you create a blobstore service, you're given one bucket to use. Maybe you don't have access to list buckets. Can you try listing objects in the bucket created?

Also, is this error while running locally or while in the Cloud Foundry environment? It won't work locally without a tunnel to the Predix network.

Comment
Add comment · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

30 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

HOW to use BLOB to upload file 2 Answers

Unable to access Blobstore object 4 Answers

Accessing BlobStore from outside Predix 3 Answers

Blobstore access in Predix Select environment using AWS SDK 7 Answers

Access blobstore from Python on Predix Select 3 Answers

GE Monogram
  • Legal
  • Cookies
  • Forum Terms
  • Contact Us
  • Copyright © 2017 General Electric Company. All rights reserved.


Enterprise
Social Q&A

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Submit your feedback or feature request
  • Categories
  • Questions
  • Predix | Updates
    • Pricing
    • Product
  • Deloitte - Private
  • How-To
  • Accenture-Private
  • Explore
  • Topics
  • Questions
  • Articles
  • Feedback or Feature Requests