Skip to main content

Overview

OpenSRE uses AWS to map your environment: Lambda functions, EKS clusters, S3 buckets, and more. It reads infrastructure state to build context when you ask about cloud resources. Related AWS tool pages (same credentials, no separate setup): EC2, ELB, S3, Lambda, and CloudTrail.

Prerequisites

  • AWS account with IAM permissions
  • Either a role ARN (recommended) or static access keys. A role ARN is assumed using your ambient AWS credentials — environment keys, an aws configure profile, or an attached instance/task role — so one of those must exist on the machine running OpenSRE

Setup

Option 1: Interactive CLI

Provide a role ARN or static access keys when prompted. If you pick a role and this machine has no base AWS credentials, setup offers to switch to access keys, pause so you can run aws configure, or continue anyway (for EC2/ECS/Lambda with an attached role).

Option 2: Environment variables (IAM role)

Option 3: Environment variables (static keys)

Either AWS_ROLE_ARN or AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY is required. AWS_ROLE_ARN alone is not enough on a laptop: the role is assumed with whatever credentials boto3 finds (env keys, ~/.aws/credentials, or an instance/task role), and that identity needs sts:AssumeRole on the role.
For multiple AWS accounts or regions, use multi-instance with AWS_INSTANCES.

Option 4: Persistent store

Credentials

  1. Create an IAM role that OpenSRE can assume (or attach to the host).
  2. Attach read-only permissions (see below).
  3. Set AWS_ROLE_ARN (and optional AWS_EXTERNAL_ID) or enter the ARN in opensre integrations setup aws.

Static access keys

  1. Create an IAM user with the same read-only permissions.
  2. Create an access key and set AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY (and AWS_SESSION_TOKEN if temporary).

IAM permissions

OpenSRE needs read-only access. Attach the AWS managed ReadOnlyAccess policy, or a custom policy scoped to the services you want OpenSRE to inspect. For least privilege, the minimum services used are:
opensre integrations verify aws assumes AWS_ROLE_ARN when set. Many AWS tools (S3, CloudTrail, EC2, ELB, Lambda) call AWS through the ambient credential chain (environment keys, shared profile, or instance/task role) and do not assume that role for the API call. Give S3/CloudTrail/EC2 permissions to the identity the OpenSRE process actually runs as.

Tools

Verify

Expected output (role example):
Expected output (static keys example):
Inside the REPL: /integrations verify aws or /verify aws. Aliases such as eks also map to this check.

Local verification recipe

A short end-to-end recipe to bring AWS up locally, confirm the verifier passes, exercise execute_aws_operation against real data, and tear everything down. This uses temporary credentials from an existing AWS account or SSO session — no long-lived infrastructure to provision.

Bring it up (credentials)

If you authenticate with AWS SSO (aws sso login), the credentials are not exposed as environment variables by default. Export them into the variables OpenSRE’s env resolver reads:
Static access keys or a role ARN work too — see Setup above.

Verify

Expected:

Exercise execute_aws_operation

execute_aws_operation is the registered AWS tool. It is read-only: the allowlist admits describe_*, get_*, list_*, head_*, select_*, batch_get_*, lookup_* (e.g. cloudtrail.lookup_events), and the exact operations query and scan (e.g. dynamodb.query). Mutating operations (e.g. terminate_instances) are rejected with an "Operation not allowed" error. The agent needs an explicit service and operation to call it, so to exercise it directly, look it up in the tool registry and run it. Any region works — set AWS_REGION, or pass a region-scoped service; us-east-1 is used here as the example:
A successful call returns a payload of this shape (redacted):
Other read-only operations confirmed against a live account (output trimmed and redacted):
  • ec2 / describe_instances — returned a running t2.micro in us-east-1a with full metadata.
  • s3 / list_buckets — returned the account’s real buckets.
  • iam / list_roles with parameters={"MaxItems": 5} — returned real IAM roles; confirms parameters pass through to the API.
  • ecs / list_clusters — returned {"clusterArns": []}, a valid empty result ("found": true), not a stub or error.
Because AWS spans many regions, target another region either by exporting a different AWS_REGION or by passing a region-scoped service/parameters combination; global services (e.g. iam) report "region": "aws-global" in the metadata.

Teardown

There is no cloud infrastructure to remove. What you clean up depends on how you configured AWS. If you only exported credentials for this session (the SSO / env-var path above), clear them from your shell:
If you ran opensre integrations setup aws, that writes to three tiers — the integration store, the project .env (non-secret fields), and an owner-only local secret file at ~/.opensre/credentials.json (secret fields such as AWS_SECRET_ACCESS_KEY / AWS_SESSION_TOKEN). opensre integrations remove aws clears only the store entry, so clear the other two tiers too or the credentials stay resolvable:
  1. Remove the store entry:
  2. Delete the non-secret AWS_* lines (AWS_ROLE_ARN, AWS_EXTERNAL_ID, AWS_REGION, AWS_ACCESS_KEY_ID) from your project .env.
  3. Delete the secret entries from the local secret store. OpenSRE stores secrets in ~/.opensre/credentials.json, not the OS keychain. Remove the AWS keys from it:
    delete_secret removes each key from every local tier. Deleting ~/.opensre/credentials.json outright also works if it holds no other integration’s secrets.

Troubleshooting

Security

  • Prefer IAM roles over static keys wherever possible.
  • Scope IAM permissions to only the AWS services OpenSRE needs to inspect.
  • Rotate static access keys regularly.
  • Enable CloudTrail so all OpenSRE API calls are auditable.
  • Store keys in .env or your secret manager — not in source control.