Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable IAM role-based auth between EC2 and S3 #99

Closed

Conversation

zekehuntergreen
Copy link

@zekehuntergreen zekehuntergreen commented Jul 4, 2023

related to alephdata/aleph#3185

What

Enables IAM role-based auth by allowing environment variables AWS_KEY_ID and AWS_SECRET_KEY to be left unpopulated. When neither is populated, key_id and secret_key won't be passed to the s3 client constructor which will instead look for credentials in instance metadata.

Why

As described in the issue above, role based auth has a few advantages over user-based auth:

  • better security: admins wouldn't need to store, and manage, and rotate secret keys, risking their being compromised.
  • more specific access control: only the EC2 instance running Aleph will have access to the archive S3 bucket, rather than any client with the access key

Note: when Aleph is running on docker on an EC2 instance, it might be necessary to increase its launch template's HttpPutResponseHopLimit from the default of 1 to 2 so that instance metadata can be fetched.

Copy link
Contributor

@stchris stchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor question, looks good otherwise 👍

servicelayer/archive/s3.py Show resolved Hide resolved
@stchris
Copy link
Contributor

stchris commented Jul 5, 2023

Closing as per our discussion in the comments: passing None or "" is enough and boto will handle the proper case for us.

@stchris stchris closed this Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants