> For the complete documentation index, see [llms.txt](https://serverlessguru.gitbook.io/sls-jest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://serverlessguru.gitbook.io/sls-jest/aws-credentials.md).

# AWS Credentials

Under the hood, `sls-jest` uses the AWS SDK for javascript. Thus, credentials are taken in order of preference as described on [this page](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html).

## Locally on your machine

When running jest on your local machine, the simplest way is to use your shared credentials file. By default, the `default` profile is used. You can use another profile by passing it as the `AWS_PROFILE` env variable before you invoke `jest`.

```bash
AWS_PROFILE=playground npx jest
```

You can also use something like [direnv](https://github.com/direnv/direnv) to automatically set the right profile for your project.

Side note: We recommend [leapp](https://www.leapp.cloud/) to manage your local credentials.

## CI/CD

When running tests in a CI/CD environment, the recommended way is to use OIDC. The assumed role must have sufficient permissions to access all the resources your test suite uses (or [creates](/sls-jest/spies/setup.md))

You should check the documentation of your CI/CD provider. Here are some guides for popular ones:

* [Github Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services) (also see [this article](https://benoitboure.com/securely-access-your-aws-resources-from-github-actions))
* [GitLab](https://docs.gitlab.com/ee/ci/cloud_services/aws/)
* [Bitbucket](https://support.atlassian.com/bitbucket-cloud/docs/deploy-on-aws-using-bitbucket-pipelines-openid-connect/)
* [CircleCi](https://circleci.com/docs/openid-connect-tokens/#aws)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://serverlessguru.gitbook.io/sls-jest/aws-credentials.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
