-
Notifications
You must be signed in to change notification settings - Fork 117
[AWS] Use credentials and config from AWS SDK file #1114
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
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
95437b1
Add support for SSO credentials in AWS Lambda backend
aitorarjona 1fc59df
Add support for SSO credentials in AWS s3
aitorarjona ce8f499
Remove pin in aws reqs
aitorarjona bf1ca7e
Add deprectation warning when using aws secrets in lithops config
aitorarjona 30941a0
Merge master
aitorarjona 19831b3
Update lambda backend to support aws config profiles
aitorarjona 118b1e6
Update changelog
aitorarjona 5ba0c46
Update docs
aitorarjona dc4dce2
Fixes review
aitorarjona 8d4ff11
Add support for unsinged boto3 client
aitorarjona 5344797
Merge upstream master
aitorarjona 06b1dc8
Docs update, removed aws credentials deprecration notice
aitorarjona e792c2a
Remove secrets from aws lambda payload
aitorarjona 36de64c
Fix automatic storage_bucket name for AWS with config profiles
aitorarjona 506209f
Merge master
aitorarjona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,6 @@ python3 -m pip install lithops[aws] | |
| "Version": "2012-10-17", | ||
| "Statement": [ | ||
| { | ||
| "Sid": "VisualEditor0", | ||
| "Effect": "Allow", | ||
| "Action": [ | ||
| "s3:*", | ||
|
|
@@ -44,34 +43,72 @@ python3 -m pip install lithops[aws] | |
|
|
||
| 7. Choose **Lambda** on the use case list and click **Next: Permissions**. Select the policy created before (`lithops-policy`). Click **Next: Tags** and **Next: Review**. Type a role name, for example `lithops-execution-role`. Click on *Create Role*. | ||
|
|
||
| ## Configuration | ||
| ## AWS Credential setup | ||
|
|
||
| 6. Edit your lithops config and add the following keys: | ||
| Lithops loads AWS credentials as specified in the [boto3 configuration guide](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html). | ||
|
|
||
| In summary, you can use the following settings: | ||
|
|
||
| 1. Provide credentials via the `~/.aws/config` file. **This is the preferred option to configure AWS credentials for use with Lithops**: | ||
|
|
||
| You can run `aws configure` command if the AWS CLI is installed to setup the credentials. | ||
|
|
||
| 2. Provide credentials via environment variables: | ||
|
|
||
| Lithops needs at least `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_DEFAULT_REGION` environment variables set. | ||
|
Comment on lines
+56
to
+58
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe in this option you can put a config example (and maybe remove lithops:
backend: aws_lambda
aws_lambda:
execution_role: <EXECUTION_ROLE_ARN>
region: <REGION_NAME> |
||
|
|
||
| 3. Provide the credentials in the `aws` section of the Lithops config file: | ||
| ```yaml | ||
| lithops: | ||
| backend: aws_lambda | ||
|
|
||
| aws: | ||
| region: <REGION_NAME> | ||
| access_key_id: <AWS_ACCESS_KEY_ID> | ||
| secret_access_key: <AWS_SECRET_ACCESS_KEY> | ||
| region: <REGION_NAME> | ||
|
|
||
| aws_lambda: | ||
| execution_role: <EXECUTION_ROLE_ARN> | ||
| region: <REGION_NAME> | ||
| ``` | ||
|
|
||
| ## Summary of configuration keys for AWS | ||
| ### Setup for SSO-based users | ||
|
|
||
| ### AWS | ||
| Users using SSO-based accounts do not require an IAM user, and have temporal session access tokens instead. To configure access to SSO-based accounts, you can configure a profile in the `~/.aws/config` file for using SSO authentication: | ||
|
|
||
| ```yaml | ||
| [profile my-sso-profile] | ||
| sso_start_url = https://XXXXXXXX.awsapps.com/start | ||
| sso_region = us-east-1 | ||
| sso_account_id = XXXXXXXXXXX | ||
| sso_role_name = XXXXXXXXXXXXXXXXX | ||
| region = us-east-1 | ||
| ``` | ||
|
|
||
| Then, you can log in or refresh your credentials by using the sso login command: | ||
|
|
||
| ``` | ||
| $ aws sso login --profile my-sso-profile | ||
| ``` | ||
|
|
||
| To use this profile, you must specify it in the `aws` section of the Lithops config file: | ||
|
|
||
| |Group|Key|Default|Mandatory|Additional info| | ||
| |---|---|---|---|---| | ||
| |aws | region | |yes | AWS Region. For example `us-east-1` | | ||
| |aws | access_key_id | |yes | Account access key to AWS services. To find them, navigate to *My Security Credentials* and click *Create Access Key* if you don't already have one. | | ||
| |aws | secret_access_key | |yes | Account secret access key to AWS services. To find them, navigate to *My Security Credentials* and click *Create Access Key* if you don't already have one. | | ||
| |aws | session_token | |no | Session token for temporary AWS credentials | | ||
| |aws | account_id | |no | *This field will be used if present to retrieve the account ID instead of using AWS STS. The account ID is used to format full image names for container runtimes. | | ||
| ```yaml | ||
| lithops: | ||
| backend: aws_lambda | ||
|
|
||
| aws: | ||
| config_profile: my-sso-profile | ||
|
|
||
| aws_lambda: | ||
| execution_role: <EXECUTION_ROLE_ARN> | ||
| region: <REGION_NAME> | ||
| ``` | ||
|
|
||
| More info [here](https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html). | ||
|
|
||
|
|
||
| ## Summary of configuration keys for AWS Lambda | ||
|
|
||
| ### AWS Lambda | ||
|
|
||
|
|
@@ -90,6 +127,18 @@ aws_lambda: | |
| | aws_lambda | ephemeral_storage | 512 | no | Ephemeral storage (`/tmp`) size in MB (must be between 512 MB and 10240 MB) | | ||
| | aws_lambda | env_vars | {} | no | List of {name: ..., value: ...} pairs for Lambda instance environment variables | | ||
|
|
||
| ### AWS | ||
|
|
||
| |Group| Key | Default | Mandatory | Additional info | | ||
| |---|-------------------|----------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| |aws | region | | yes | AWS Region. For example `us-east-1` | | ||
| |aws | config_profile | "default" | no | AWS SDK [configuration profile](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-a-configuration-file) name. | | ||
| |aws | access_key_id | | no | Account access key to AWS services. To find them, navigate to *My Security Credentials* and click *Create Access Key* if you don't already have one. | | ||
| |aws | secret_access_key | | no | Account secret access key to AWS services. To find them, navigate to *My Security Credentials* and click *Create Access Key* if you don't already have one. | | ||
| |aws | session_token | | no | Session token for temporary AWS credentials | | ||
| |aws | account_id | | no | *This field will be used if present to retrieve the account ID instead of using AWS STS. The account ID is used to format full image names for container runtimes. | | ||
|
|
||
|
|
||
| ## Additional configuration | ||
|
|
||
| ### VPC | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How the
~/.aws/configlooks like in this case? are the keys going into a default profile by defaut? or are the keys set in the file without a profile?I mean, after calling
aws configure, you get this:?or something like this:?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if in this case it makes sense to force the user to provide a
profile_namewithaws configure --profile my-unique-profile-nameand then configure lithops like in the SSO approach, with: