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 configureprofile, or an attached instance/task role — so one of those must exist on the machine running OpenSRE
Setup
Option 1: Interactive CLI
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.AWS_INSTANCES.
Option 4: Persistent store
Credentials
IAM role (recommended)
- Create an IAM role that OpenSRE can assume (or attach to the host).
- Attach read-only permissions (see below).
- Set
AWS_ROLE_ARN(and optionalAWS_EXTERNAL_ID) or enter the ARN inopensre integrations setup aws.
Static access keys
- Create an IAM user with the same read-only permissions.
- Create an access key and set
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY(andAWS_SESSION_TOKENif temporary).
IAM permissions
OpenSRE needs read-only access. Attach the AWS managedReadOnlyAccess 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
/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, exerciseexecute_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:
Verify
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:
ec2/describe_instances— returned a runningt2.microinus-east-1awith full metadata.s3/list_buckets— returned the account’s real buckets.iam/list_roleswithparameters={"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.
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: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:
-
Remove the store entry:
-
Delete the non-secret
AWS_*lines (AWS_ROLE_ARN,AWS_EXTERNAL_ID,AWS_REGION,AWS_ACCESS_KEY_ID) from your project.env. -
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_secretremoves each key from every local tier. Deleting~/.opensre/credentials.jsonoutright 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
.envor your secret manager — not in source control.