Generate AWS credentials for accessing S3 buckets - amazon-web-services

I have a couple of S3 buckets and I want to access them from an app. How do I generate AWS credentials with access restricted to those buckets? I suppose it would require using IAM users and groups.

Related

How to create S3 Bucket for three different environments using single root account?

I've one AWS root account, if I need to grant the S3 bucket access to our application resides in Dev, Test and Prod environments. These S3 bucket will be accessed only by application and not by individual / manual user. I can refer multiple approaches, not sure which one is best approach here? Could you pls suggest on this?
Option-1: Create IAM user account for each environment with programmatic access only. Provide the Access KeyId and Secret Access key to respective environment(Dev, Test and Prod) to access the S3 resource. Separate S3 bucket will be created for each environment, S3 bucket policy will only allow the access to specific IAM user account only.
Option-2: Three separate AWS accounts. Not sure how to proceed on this further, will be having three root accounts to manage and separate billing, one S3 bucket for each AWS account.
Option-3: I can refer the landing zone concepts that comes with AWS organization account, Shared Services account, Log Archive Account and Security Account. Not sure where to specify / create the resources and IAM user account.

Access control for AWS Managed services

Our organization is planning to use AWS Managed services like Rekognition, Textract etc. Since these services uses S3 buckets for Face comparison and analyzing documents. The concern is end users shouldn't be able to access buckets outside our organization, is there any way I can limit the access for only S3 buckets in my organization? Buckets can be created on the fly by the user, so the access control should cover all the buckets in the account.
We're also using VPC endpoints for these services.
There is no capability to configure Rekognition such that it can only use buckets within the specific AWS Account.
Objects in Amazon S3 are private by default. IAM Users in your organization will only have access to buckets for which they have been granted access via a policy on their IAM User, or via a Bucket Policy on the bucket itself.
If a user references an S3 object in a call to Amazon Rekognition, the user must have access to the bucket via an IAM Policy or Bucket Policy. If they can access the object, then they can use the object with Rekognition.
In other words, if they have general access to an object (eg to download the object), then they can use Rekognition with it.

Use AWS keys to transfer data between organizations

I am trying to move client data from clients S3 bucket(s3://client-bucket) to our organizations S3 bucket(s3://org-bucket) I was given access keys to the clients S3 bucket.
Using AWS CLI i am able to access S3 bucket of client as see all files. I cannot however use aws s3 mv because the profile that has access to client-bucket does not have permissions set up for org-bucket.
I am not allowed to move data to an intermediate public bucket bc of security issues/sensitivity of data.
What is the best way of making this transfer go thru? Is there a way to set up a profile in aws cli config/credentials with both the access keys to org-bucket and client-bucket?
The best way is to use the access keys in your organization to access your client's S3 bucket. Since you need to copy objects directly via the CopyObject API, your IAM user/role needs to have access to both the S3 bucket in your org AND your client's S3 bucket. Therefore, your current approach doesn't work and even AssumeRole would not work either. You can follow this guide to configure proper resource-based policies in S3.

How to access a public S3 bucket from another AWS account?

In one of the blog post, the author has mentioned that he uploaded dataset into a s3 bucket and gave public access.
s3://us-east-1.elasticmapreduce.samples/flightdata/input
Now I want to download/see the data from my chrome browser.
When I copy paste above link in chrome address bar it is asking for:
Access key ID
Secret access key
What should I give here?
Did the author initially made it public and now made it private?
(I am confused)
Also can we access these kind of URLs that start with s3:// directly from browsers?
Should I need to have a AWS account to access these S3 buckets?
(I know we can access web data using http protocol.. http://)
The Amazon S3 management console allows you to view buckets belonging to your account. It is not possible to view S3 buckets belonging to other accounts within the S3 console.
You can, however, access them via the AWS Command-Line Interface (CLI). For example:
aws s3 ls s3://us-east-1.elasticmapreduce.samples/flightdata/input/
You can also copy files from other buckets by using aws s3 cp and aws s3 sync.
These calls require a set of valid AWS credentials (Access Key and Secret Key), which can be stored in the credentials files via the aws configure command. You do not need specific permission to access public buckets, but you do need permission to use S3 in general. You can obtain an Access Key and Secret Key in the IAM management console where your IAM User is defined. (Or, if you do not have permission to view it, ask your AWS administrator for the Access Key and Secret Key.)

upload to s3 from ec2 without access key

Can you connect to S3 via s3cmd or mount S3 to and ec2 instance with IAM users and not using access keys?
All the tutorials I see say to use access keys but what if you can't create your own access keys (IT policy).
There are two ways to access data in Amazon S3: Via an API, or via URLs.
Via an API
When accessing Amazon S3 via API (which includes code using an AWS SDK and also the AWS Command-Line Interface (CLI)), user credentials must be provided in the form of an Access Key and a Secret Key.
The aws and s3cmd utilities, and also software that mounts Amazon S3 as a drive, require access to the API and therefore require credentials.
If you have been given a login to an AWS account, you should be able to ask your administrators to also create credentials that are associated with your User. These credentials will have exactly the same permissions as your normal login (via Username/password), so it's strange that they would be disallowing it. They can be very useful for automating AWS activities, such as starting/stopping Amazon EC2 instances.
Via URLs
Objects stored in Amazon S3 can also be made available via a URL that points directly to the data, eg s3.amazonaws.com/bucket-name/object.txt
To provide public access to these objects without requiring credentials, either add permission to each object or create a Bucket Policy that grants access to content within the bucket.
This access method can be used to retrieve individual objects, but is not sufficient to mount Amazon S3 as a drive.