datadog-ci icon indicating copy to clipboard operation
datadog-ci copied to clipboard

[lambda] Support AWS named profiles

Open duncanista opened this issue 2 years ago • 2 comments

What and why?

The aws-cli allows users to have multiple credentials in a file, commonly separated by named profiles. Those credentials are stored by default in the path ~/.aws/credentials. AWS also allows users to have those credentials store in a specific path, which the user can provide by setting the environment variable AWS_SHARED_CREDENTIALS_FILE. These credentials are mainly used to use AWS services through the CLI.

The main goal of this PR is to allow the user to provide those credentials by using named profiles in the same manner AWS handles it. -p,--profile is a feature which takes a string and grabs the credentials from the expected file path.

How?

  • Adding a the -p,--profile option in the lambda commands.
  • Handling the credentials using the aws-sdk given a profile.

=> This feature could be considered as a breaking change if used in CI with credentials that have MFA enabled <=

Review checklist

  • [x] Feature or bugfix MUST have appropriate tests (unit, integration)
  • [ ] [Synthetics] New releases of datadog-ci MUST be followed by a synthetics-ci-github-action release

duncanista avatar Sep 15 '22 20:09 duncanista

Datadog Report

Branch report: jordan.gonzalez/support-named-profiles Commit report: 2cff5f3

:white_check_mark: datadog-ci-tests 0 Failed, 0 New Flaky, 1140 Passed, 0 Skipped, 1m1.07s Wall Time

Datadog Report

Branch report: jordan.gonzalez/support-named-profiles Commit report: 2566253

:white_check_mark: datadog-ci-tests 0 Failed, 0 New Flaky, 1206 Passed, 0 Skipped, 51.44s Wall Time

Datadog Report

Branch report: jordan.gonzalez/support-named-profiles Commit report: 5c22d31

:white_check_mark: datadog-ci-tests 0 Failed, 0 New Flaky, 3681 Passed, 0 Skipped, 1m 39.7s Wall Time