AWS s3 accessing private data - node.js

I have stored data in the aws bucket using ACL private. So can i get the data back from third party app. I couldn't find any help on the documentation. Any example will be helpful.

Make sure you have your AWS config set up by following this: http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html
Then make sure permissions are set that correspond to that AWS config: http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#permissions

Related

Can I get information on an S3 Bucket's public access bucket Settings from boto3?

I am using boto3 to extract information about my S3 buckets.
However, I am stuck at this point. I am trying to extract information about a bucket's public access (see attached screenshot).
How can I get this information? So far I have failed to find out any boto3 function that allows me to do so.
You can use get_public_access_block():
Retrieves the PublicAccessBlock configuration for an Amazon S3 bucket.
When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains the object) and the bucket owner's account. If the PublicAccessBlock settings are different between the bucket and the account, Amazon S3 uses the most restrictive combination of the bucket-level and account-level settings.
If you wish to modify the settings, you can use: put_public_access_block()

NodeJS Multer-S3 can upload to S3 without using credentials?

I'm a little bit lost as to what's going on, I've been trying to solve this for a few days now. I'm trying to only allow my IAM user to upload an image with public access to read. However, I can comment out the IAM user credentials from AWS-SDK and it would still upload to my S3 bucket with no problem. This is not how I intended it to work. I have a feeling it's my policies but I'm not really sure where to start.
Here are the AWS-SDK credentials being commented out in my code
Here is the code for uploading an image to S3
Here is another piece of code used for uploading an image
For some reason, this is enough to upload to my S3 bucket. Just to clarify, I want to make sure the file is being uploaded only if it has the proper credentials. Currently, the file is being uploaded even when S3 credentials are commented out.
The following are my AWS S3 policies/permissions.
AWS public access bucket settings (my account settings also look like this, since those settings override the buckets settings)
AWS bucket policy
Bucket ACL
Bucket Cors
If you can point me in the right direction, that'll be fantastic. I'm pretty new to using AWS S3 and am a little lost.
Thanks a bunch.
this happened to me as well. if there are no credentials in your code, it will default to using those in your .aws directory if you have credentials stored there on your local filesystem.

AWS Linking Dynamo DB and S3 bucket

I'm creating a project that tracks potential employees for a company.
I want to upload some pdfs to an AWS S3 bucket. I want to store a link to each pdf inside an existing dynamoDB table (one record per pdf). Any advice would be greatly appreciated.
I am dynamically generating new users and want to be able to add the pdf to the bucket and the link in dynamoDB simultaneously. Can I do this via a lambda function at the same time?
Can I do this via a lambda function at the same time? .-
yes, you can do. you must have the following things in mind:
Create lambda
Configure IAM role for execute lambda
Add trigger and its permissions, example for dynamodb:
Allow: dynamodb:PutItem
Add trigger and its permissions for bucket s3:
Allow: s3:PutObject
Also, with serverless is very easy, only you must configure yml config and associate the resources (in this case s3), here an example that i did.
If you want to see it working:
npm install
npm run deploy
If you want to test:
npm install
npm run test
important: you must configured AWS Credentials in your machine, here's the doc

How to get user information using awscli for Softlayer?

$aws configure set region=CrossRegion-US
$ aws iam get-user.
Could not connect to the endpoint URL: https://iam.CrossRegion-US.amazonaws.com/
Is this happening because I have set an incorrect region or is Softlayer in progress of improving the API support?
I have also used the region from authentication endpoints. Still, I get the same error.
Setting custom endpoints is not possible within the ~/.aws/config or ~/.aws/credentials files, instead it must be passed as an argument to each command. In your example above, you were trying to connect to AWS because a custom endpoint was not provided to let the CLI know where to connect.
For example, to list the contents of bucket-1:
aws --endpoint-url=https://{endpoint} s3 ls s3://bucket-1/
In the case of IBM Cross-Region object storage, the default endpoint would be s3-api.us-geo.objectstorage.softlayer.net. (In this case, the region would be us-standard, although this is not necessary to explicitly declare as it is the only region currently offered.)
For more information, the documentation has information on both using the AWS CLI and connecting to endpoints.
All that said, user information is not accessible using the implementation of the S3 API. Some user information can be accessed using the SoftLayer API, but generally speaking user information isn't directly used by the object storage system in this release, as permissions are issued at the storage account level.

How can I check if the AWS SDK was provided with credentials?

There are many ways to provide the AWS SDK with credentials to perform operations.
I want to make sure any of the methods were successful in setting up the interface before I try my operation on our continuous deployment system.
How can I check if AWS SDK was able to find credentials?
You can access them via the config.credentials property on the main client. All AWS service libraries included in the SDK have a config property.
Class: AWS.Config
The main configuration class used by all service objects to set the region, credentials, and other options for requests.
By default, credentials and region settings are left unconfigured. This should be configured by the application before using any AWS service APIs.
// Using S3
var s3 = new AWS.S3();
console.log(s3.config.credentials);

Resources