Getting access denied with an AWS hosted file on S3 from an AWS tutorial - amazon-s3

I am trying to download a file hosted on S3 and I am getting access denied errors. I was wondering if it was an issue on the AWS side or something on my side.
In the tutorial site below it has a link to download LoadingDataSampleFiles.zip https://docs.aws.amazon.com/redshift/latest/dg/tutorial-loading-data-download-files.html
I click the link and get an access denied page.
I find that AWS has incomplete info on some of there tutorials which can be very aggravating when trying to learn!!!

Related

uploading file to s3 service provided by IONOS

Trying to find a tool which would help me to upload files/folders to s3 storage provided by IONOS hosting. IONOS do not have a native s3 SDK for uploading. If someone has done it via any other methods please let me know it would be very helpful;

Amplify logged in users cannot access S3 files using the Auth_Role

I have a small question regarding Cognito authentication and S3. I tried to connect external S3 and Cognito instances to Amplify (Not managed by Amplify, I created manually). In the system, we can upload files to the S3 bucket and view them. I use Amplify JS's Storage class to do all this. The thing that got me confused is that when I give S3 permissions to the Cognito Auth_Role, my users cannot upload or view any files even-though they are logged into the system. When I give permission to the Unauth_Role, it works. Any idea why?

Programmatic access to AWS IAM users policy and access

I have an app that uses the AWS SDK iOS 2.9.10 to login an AWS IAM user to his/hers AWS S3 account. I would like to be able to assess whether the user has read/write access to various S3 buckets under the account. Basically, I would like to programmatically do this:
aws iam list-user-policies --user-name IAM_User_Name
aws iam get-user-policy --user-name IAM_User_Name --policy-name IAM_Policy_Name
Using these outputs to know which S3 bucket to which IAM user has access, I could then check the Action field in the IAM policy if it allows permission like "s3:GetObject" or "s3:" and resource field contains the value as "arn:aws:s3:::examplebucket/" or "*". If both applicable then IAM user has permission to the S3 "examplebucket".
However, I am unable to figure out if this kind of IAM access is possible programmatically using AWS SDK iOS (Swift or Objective-C) so any help would be very useful.
I think this feature is not provided by the AWS SDK iOS since there is an open issue on GitHub which was closed unanswered. [1]
Instead, you can query the service directly using the service's so called IAM Query API [2].
AWS states that:
AWS provides SDKs that consist of libraries and sample code for various programming languages and platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to IAM and AWS. For example, the SDKs take care of tasks such as cryptographically signing requests (see below), managing errors, and retrying requests automatically. For information about the AWS SDKs, including how to download and install them, see the Tools for Amazon Web Services page.
Unfortunately the iOS SDK is not officially supported by the IAM service. That is why the IAM service endpoints are not included in the iOS SDK. You could try to open another feature request on GitHub though...
If you decide to implement the HTTP client and proper request signing manually, you can use the IAM commands which you mentioned above (in AWS terms called "Actions"), e.g. the ListUserPolicies action [3].
Suggestion for Improvement
I could then check the Action field in the IAM policy if it allows permission like "s3:GetObject" or "s3:" and resource field contains the value as "arn:aws:s3:::examplebucket/" or "*". If both applicable then IAM user has permission to the S3 "examplebucket".
If you want an approach which is more robust, I would suggest to use the IAM Policy Simulator API. [4]
References
[1] https://github.com/aws-amplify/aws-sdk-ios/issues/496
[2] https://docs.aws.amazon.com/IAM/latest/APIReference/Welcome.html
[3] https://docs.aws.amazon.com/IAM/latest/APIReference/API_ListUserPolicies.html
[4] https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_testing-policies.html#policies-simulator-using-api

Warning- AWS Credentials exposed on Google Play Console

I have my app published on PlayStore. I am getting this warning on my Play Console that my AWS Credentials have been exposed and i won't be able upload new apk after 12 November 2018 if the problem persists. I use the credentials for uploading images to Amazon S3. The credentials are hard coded right now.
So i need to know what should be the way to rectify this.
Thanks in advance.
Amazon have a whole blog post on dealing with this problem, and a page on best practices.
Essentially you need to revert the old credentials, and use Amazon Cognito to control access.
An updated link on cognito lives here

How to Give Access to non-public Amazon S3 bucket folders using Parse authenticated user

We are developing a mobile app using Parse as our BAAS solution but using Amazon S3 for storage of our media files. All of our users upload media files into their own individual folders inside of our app's bucket. As the user uploads media files we update their records in Parse so it knows where to download the files. That's the easy part.
I've spent quite a bit of time researching the different policies for S3 buckets and I am trying to get a grip on the proper way to ensure the security of the content uploaded. If you do all of your work with DynamoDB or SimpleDB then it's easy because you're essentially adjusting your ACLs with the IAM accounts and whatnot. If you use Amazon Cognito it's also easy because authentication happens through Google, Facebook or Amazon accounts. In my case I am using Parse to authenticate users which cannot speak to Amazon directly.
My goal is that only the currently logged in Parse user with ID #1234567 can access their own 1234567 folder and files (as well as any other user given permission by this person for collaboration). Here is a post similar to what I'm trying to accomplish: amazon S3 bucket policy - restricting access by referer BUT not restricting if urls are generated via query string authentication
...but how do I accomplish this with the current user's ID number?
Even better question is whether that post mentioned above is best practice or should I instead be looking at creating an EC2 server to handle access to these files? Should I be looking at CloudFront to serve private content? Or is there another method that works better for what I am trying to accomplish? I am going in circles and my head is spinning.
Thanks to whoever can help straighten me out.
Well since Parse is being shut down I am migrating to another service. This question is no longer relevant.