How to make ECR repository public? - amazon-web-services

How to make an ECR repository public for anybody to pull from. I see the policy document in the permission sections is where I should make permission changes. But it's not working, and I still need to get authenticated with the IAM user.

Amazon ECR currently supports private images. See official AWS ECR FAQ:
https://aws.amazon.com/ecr/faqs/
Q: Can Amazon ECR host public container images?
Amazon ECR currently supports private images. However, using IAM resource-based permissions, you can configure policies for each repository to allow access to IAM users, roles, or other AWS accounts.
You can use Docker Hub or other public repositories.
https://hub.docker.com/

Amazon just released support for public ECR repositories!
https://aws.amazon.com/blogs/aws/amazon-ecr-public-a-new-public-container-registry/

check out https://github.com/monken/aws-ecr-public. It's a solution that provisions a serverless API Gateway to make ECR repositories public. It also supports custom domains.

Related

Accessing S3 bucket data from EC2 instance through IAM

So I have created an IAM user and added a permission to access S3 then I have created an EC2 instance and SSH'ed into the it.
After giving "aws s3 ls" command, the reply was
"Unable to locate credentials. You can configure credentials by running "aws configure".
so what's the difference between giving IAM credentials(Key and Key ID) using "aws configure" and editing the bucket policy to allow s3 access to my instance's public IP.
Even after editing the bucket policy(JSON) to allow S3 access to my instance's public IP why am I not able to access the s3 bucket unless I use "aws configure"(Key and Key ID)?
Please help! Thanks.
Since you are using EC2 you should really use EC2 Instance Profiles instead of running aws configure and hard-coding credentials in the file system.
As for the your question of S3 bucket policies versus IAM roles, here is the official documentation on that. They are two separate tools you would use in securing your AWS account.
As for your specific command that failed, note that the AWS CLI tool will always try to look for credentials by default. If you want it to skip looking for credentials you can pass the --no-sign-request argument.
However, if you were just running aws s3 ls then that was trying to list all the buckets in your account, which you would have to have IAM credentials for. Individual bucket policies would not be taken into account in that scenario.
If you were running aws s3 ls s3://bucketname then that may have worked as aws s3 ls s3://bucketname --no-sign-request.
When you create iam user so there are two parts
policies
roles
Policies are attached to user, like what all services user can pr can't access
roles are attached to application, what all access that application can have
So you have to permit ec2 to access S3
There are two ways for that
aws configure
attach role to ec2 instance
while 1 is tricky and legthy , 2 is easy
Go to ec2-instance-> Actions -> Security -> Modify IAM role -> then select role (ec2+s3 access role)
thats it , you can simply do aws s3 ls from ec2 instance

How to restrict AWS CLI Access for SSO User

I have SSO configured for my AWS organizational accounts. Have created two accounts(one is dev and the other is prod). How do i restrict AWS CLI Access for my prod accounts SSO users. Tried looking up in their documentation, but couldn't find any.
Can someone help me?
The AWS Command-Line Interface (CLI) can be configured to connect via SSO and assume an IAM Role. It can then be used to make API calls according to the permissions in the chosen IAM Role.
It is not possible to 'restrict' the AWS CLI. Instead, you would restrict the permissions in the IAM Role that is being used.
See: Configuring the AWS CLI to use AWS Single Sign-On - AWS Command Line Interface

Possible to access an AWS public dataset using Cyberduck?

Cyberduck version: Version 7.9.2
Cyberduck is designed to access non-public AWS buckets. It asks for:
Server
Port
Access Key ID
Secret Access Key
The Registry of Open Data on AWS provides this information for an open dataset (using the example at https://registry.opendata.aws/target/):
Resource type: S3 Bucket
Amazon Resource Name (ARN): arn:aws:s3:::gdc-target-phs000218-2-open
AWS Region: us-east-1
AWS CLI Access (No AWS account required): aws s3 ls s3://gdc-target-phs000218-2-open/ --no-sign-request
Is there a version of s3://gdc-target-phs000218-2-open that can be used in Cyberduck to connect to the data?
If the bucket is public, any AWS credentials will suffice. So as long as you can create an AWS account, you only need to create an IAM user for yourself with programmatic access, and you are all set.
No doubt, it's a pain because creating an AWS account needs your credit (or debit) card! But see https://stackoverflow.com/a/44825406/1094109 and https://stackoverflow.com/a/44825406/1094109
I tried this with s3://gdc-target-phs000218-2-open and it worked:
For RODA buckets that provide public access to specific prefixes, you'd need to edit the path to suit. E.g. s3://cellpainting-gallery/cpg0000-jump-pilot/source_4/ (this is a RODA bucket maintained by us, yet to be released fully)
NOTE: The screenshots below show a different URL that's no longer operational. The correct URL is s3://cellpainting-gallery/cpg0000-jump-pilot/source_4/
No, it's explicitly stated in the documentation that
You must obtain the login credentials [in order to connect to Amazon S3 in Cyberduck]

JupyterHub access AWS S3

I want to give access to JupyterHub users so they can use data in AWS S3. I would appreciate if anyone explain how to set up for this usage.
Also, I would prefer if there is a way to not to give AWS credentials to the JupyterHub users but they would be just allowed to have access to data in AWS S3.
Thank you!
You would definitely need an IAM user configured with the right permissions to access the S3 bucket you need (or if you need full rights on all S3 buckets, you could attach the AmazonS3FullAccess policy to your IAM user).
Then on Jupyterhub you would need to have the AWS CLI installed so that you could run the aws configure command, by which you'd be able to configure the credentials of this IAM user in the .credentials file for AWS on Jupyterhub.
Once this is all done, you could use either the CLI or the boto3 library to interact with your S3 bucket from a Jupyterhub notebook.
You can use S3 as a file system in JupyterNotebboks with this extension:
https://github.com/danielfrg/s3contents

Avoiding set up policy permissions to each ECR repository

I'm trying to set up cross-account access to ECR. What I'd like is to allow one AWS account to access the ECR in a different AWS account. The point is that it is needed to set up a policy permission under each repository. I don't like honestly this approach because for each new repository created under the ECR, I need to set up a policy. Do you have a better strategy to allow one account to automatically access all the repos in a ECR in a different AWS account?