-
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
Changes from 9 commits
95437b1
1fc59df
ce8f499
bf1ca7e
30941a0
19831b3
118b1e6
5ba0c46
dc4dce2
8d4ff11
5344797
06b1dc8
e792c2a
36de64c
506209f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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:*", | ||
|
|
@@ -52,26 +51,69 @@ python3 -m pip install lithops[aws] | |
| lithops: | ||
| backend: aws_lambda | ||
|
|
||
| aws: | ||
| aws_lambda: | ||
| execution_role: <EXECUTION_ROLE_ARN> | ||
| region: <REGION_NAME> | ||
| ``` | ||
|
|
||
| ## AWS Credential setup | ||
|
|
||
| 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. | ||
|
Comment on lines
+52
to
+54
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. How the I mean, after calling or something like this:?
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. I wonder if in this case it makes sense to force the user to provide a lithops:
backend: aws_lambda
aws:
config_profile: my-unique-profile-name
aws_lambda:
execution_role: <EXECUTION_ROLE_ARN>
region: <REGION_NAME> |
||
|
|
||
| 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 **This option is not ideal and will be removed in future Lithops releases!**: | ||
|
||
| ```yaml | ||
| lithops: | ||
| backend: aws_lambda | ||
|
|
||
| aws: | ||
| access_key_id: <AWS_ACCESS_KEY_ID> | ||
| secret_access_key: <AWS_SECRET_ACCESS_KEY> | ||
| region: <REGION_NAME> | ||
| ``` | ||
|
|
||
| aws_lambda: | ||
| execution_role: <EXECUTION_ROLE_ARN> | ||
| ### Setup for SSO-based users | ||
|
|
||
| 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 | ||
| ``` | ||
|
|
||
| ## Summary of configuration keys for AWS | ||
| Then, you can log in or refresh your credentials by using the sso login command: | ||
|
|
||
| ### AWS | ||
| ``` | ||
| $ aws sso login --profile my-sso-profile | ||
| ``` | ||
|
|
||
| To use this profile, you must specify it in the `aws` section of the Lithops config file: | ||
|
|
||
| ```yaml | ||
| lithops: | ||
| backend: aws_lambda | ||
|
|
||
| aws: | ||
| config_profile: my-sso-profile | ||
| ``` | ||
|
|
||
| More info [here](https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html). | ||
|
|
||
| |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. | | ||
|
|
||
| ## Summary of configuration keys for AWS Lambda | ||
|
|
||
| ### AWS Lambda | ||
|
|
||
|
|
@@ -90,6 +132,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 | ||
|
|
||
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.
Is the execution_role mandatory in aws_lambda? if yes I would update this .md file and include it in all the parts where you put some lithops config example, to make it clearer. Is region mandatory in all the cases? I think this lithops config example is confusing here. I would remove it and put the config example in the next section, when necessary, with all the necessary parameters.
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.
Yes,
execution_roleis mandatory. The user must specify which services can the lambda access to. We could automate this, but the user should have IAM permissions like create role... We can leave like this for now