Connect with an AWS account
Create the read-only AWS identity Valkan uses, then connect and scan the account.
One-click connect with CloudFormation
Where your Valkan deployment offers it, Connect AWS opens Open AWS CloudFormation first:
- Enter the AWS account ID, choose the regions to scan and click Open AWS CloudFormation. A new tab opens the AWS console's Quick create stack page with every field filled in. If you are not signed in to AWS, sign in first. An account that is already connected is refused here.
- Check that the account shown at the top right of the AWS console is the one you entered. The role is created in that account.
- Tick the IAM acknowledgement and click Create stack. You need permission to create CloudFormation stacks and IAM roles.
That is the last step. Valkan checks every 15 seconds; when the stack is ready, usually within two minutes, it verifies the role, checks permissions, discovers the member accounts (when the account is an Organizations management account), activates the connection and starts the first scan. Missing permissions are reported, not blocking. You can refresh or leave the page: the setup continues from Sources, where the connection shows Continue setup until it finishes. If it is still waiting after five minutes, check the account ID and that the stack shows CREATE_COMPLETE.
The stack creates one role, ValkanDiscoveryReadOnly-<suffix>, with the same read-only permissions as step 3 below. Only Valkan can assume it, and only with an External ID that Valkan generated for this connection. Delete the stack to revoke access.
If your deployment does not offer one-click connect, or you want your own role names and identities, choose Advanced in the wizard and follow the manual steps below.
Create the role with your own CloudFormation stack
Use this when one-click connect is not offered, or you want to review the template first. The stack replaces steps 2 and 3 of the manual setup below: it creates the read-only role, its trust policy and its permissions.
- Complete step 1 so the bootstrap user exists.
- Generate a random External ID (a UUID is suitable) and save it in your password manager.
- Download valkan-readonly-role.yaml.
- In the account to scan, open CloudFormation → Create stack → With new resources, choose Upload a template file and select the download.
- Name the stack
ValkanDiscoveryand enter these parameters:
| Parameter | Value |
|---|---|
ValkanPrincipalArn | arn:aws:iam::<account-id>:user/valkan-bootstrap |
ExternalId | The value from item 2 |
RoleName | ValkanDiscoveryReadOnly (the default) |
Then tick the IAM acknowledgement and click Create stack. When the stack shows CREATE_COMPLETE, continue at step 4. The Outputs tab shows the Role ARN.
To update the role after a new Valkan release, download the template again, choose Update stack → Replace existing template, and keep the parameter values. Delete the stack to revoke access.
Add organization member accounts with a StackSet
When the connected account is an Organizations management account, Valkan scans each selected member account by assuming a role there from the management account's role, with the same External ID. A StackSet creates that role in the member accounts.
First connect the management account with your own role, using the stack above or the manual setup below: these steps need the External ID you chose. One-click connect does not show its External ID, so a one-click connection cannot add member accounts this way.
Let the management role assume member roles
Skip this if the role's permissions already allow sts:AssumeRole on arn:aws:iam::*:role/ValkanDiscoveryReadOnly. Otherwise, in the management account, open the ValkanDiscoveryReadOnly role, choose Add permissions → Create inline policy → JSON and paste:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::*:role/ValkanDiscoveryReadOnly"
}]
}Create the StackSet
- Download stackset-valkandiscovery-readonly.yaml.
- In the management account, open CloudFormation → StackSets → Create StackSet, choose Service-managed permissions and upload the file. If the console asks you to activate trusted access with AWS Organizations, activate it.
- Name the StackSet, for example
ValkanDiscoveryMembers, and enter these parameters:
| Parameter | Value |
|---|---|
ManagementRoleArn | arn:aws:iam::<management-account-id>:role/ValkanDiscoveryReadOnly |
ExternalId | The External ID of the management account connection |
RoleName | ValkanDiscoveryReadOnly (the default) |
Then finish the StackSet:
- Deploy to the organization, or to the organizational units you want scanned, and turn on automatic deployment so new accounts get the role.
- Choose one region only. IAM roles are global, so a second region fails because the role already exists.
- Tick the IAM acknowledgement, submit, and wait for the operation to show
SUCCEEDED. Then run a scan in Valkan.
A service-managed StackSet does not deploy to the management account, which already has its role. A selected member account that Valkan cannot enter shows errors in the scan, not a clean result: check that the StackSet reached it and that its External ID matches the connection's. To update the member roles, edit the StackSet and replace its template with a fresh download.
Manual setup
Complete these steps in the AWS account that Valkan will scan, before choosing Connect AWS → Advanced in Valkan.
You create the IAM user and role; Valkan never creates or changes AWS resources.
You need permission to create:
- IAM users
- roles
- access keys
- an inline policy on the bootstrap user (step 1)
- a customer-managed policy, attached to the role (step 3)
The recommended setup has two identities:
valkan-bootstrap: a programmatic IAM user. Its access key can only assume the role below.ValkanDiscoveryReadOnly: an IAM role with the read-only permissions Valkan needs. This is an example name, not an AWS-managed or Valkan-created role.
1. Create the bootstrap user
- In AWS Console, open IAM → Users → Create user.
- Name it
valkan-bootstrap. - Do not give it console access.
- Create an access key under Security credentials → Create access key → Third-party service.
- Save the Access Key ID and Secret Access Key; AWS displays the secret only once.
- On the user's Permissions tab, create an inline policy.
- Replace
<account-id>with the 12-digit AWS account ID and paste:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::<account-id>:role/ValkanDiscoveryReadOnly"
}]
}This user cannot inspect your AWS resources. It can only obtain a temporary session for the specific read-only role.
2. Create the read-only role
- Choose IAM → Roles → Create role → Custom trust policy.
- Generate a random External ID (a UUID is suitable).
- Save it in your password manager.
- Replace the placeholders below, and paste this trust policy:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::<account-id>:user/valkan-bootstrap" },
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": { "sts:ExternalId": "<your-random-external-id>" }
}
}]
}Name the role ValkanDiscoveryReadOnly.
This trust policy only controls who can assume the role; it does not give the role AWS read permissions.
3. Give the role its read-only permissions
Create this as a customer-managed policy, not an inline one, and attach it to the role:
- Go to IAM → Policies → Create policy → JSON.
- Paste the policy below.
- Name it
ValkanDiscoveryReadOnlyPolicy. - Open the role and choose Add permissions → Attach policies.
Why a managed policy. This policy is about 4,600 non-whitespace characters. A customer-managed policy allows 6,144 characters, can be versioned and reused, and is what AWS recommends over inline policies. Do not attach it to the
valkan-bootstrapuser: IAM caps a user's inline policies at 2,048 characters in total.
It does not allow create, update, delete, invoke, or any other write operation.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ValkanDiscovery",
"Effect": "Allow",
"Action": [
"sts:GetCallerIdentity",
"organizations:DescribeOrganization",
"organizations:ListAccounts",
"organizations:ListParents",
"organizations:ListPoliciesForTarget",
"organizations:DescribePolicy",
"iam:ListRoles",
"iam:GetRole",
"iam:GetInstanceProfile",
"iam:ListUsers",
"iam:ListGroups",
"iam:ListAccessKeys",
"iam:GetAccessKeyLastUsed",
"iam:ListMFADevices",
"iam:GetLoginProfile",
"iam:GetAccountSummary",
"iam:ListServiceSpecificCredentials",
"iam:ListSSHPublicKeys",
"iam:ListSigningCertificates",
"iam:ListPolicies",
"iam:GetPolicy",
"iam:GetPolicyVersion",
"iam:ListEntitiesForPolicy",
"iam:ListAttachedRolePolicies",
"iam:ListRolePolicies",
"iam:GetRolePolicy",
"iam:ListAttachedUserPolicies",
"iam:ListUserPolicies",
"iam:GetUserPolicy",
"iam:ListUserTags",
"iam:ListRoleTags",
"iam:ListGroupsForUser",
"iam:ListAttachedGroupPolicies",
"iam:ListGroupPolicies",
"iam:GetGroupPolicy",
"bedrock:ListFoundationModels",
"bedrock:ListCustomModels",
"bedrock:ListProvisionedModelThroughputs",
"bedrock:ListGuardrails",
"bedrock:GetGuardrail",
"bedrock:GetModelInvocationLoggingConfiguration",
"bedrock:ListAgents",
"bedrock:GetAgent",
"bedrock:ListAgentActionGroups",
"bedrock:GetAgentActionGroup",
"bedrock:ListAgentKnowledgeBases",
"bedrock:ListAgentCollaborators",
"bedrock:ListTagsForResource",
"bedrock-agentcore:ListAgentRuntimes",
"bedrock-agentcore:GetAgentRuntime",
"bedrock-agentcore:ListGateways",
"bedrock-agentcore:GetGateway",
"bedrock-agentcore:ListGatewayTargets",
"bedrock-agentcore:GetGatewayTarget",
"sagemaker:ListEndpoints",
"sagemaker:DescribeEndpoint",
"sagemaker:ListModels",
"qbusiness:ListApplications",
"qbusiness:ListRetrievers",
"qbusiness:ListDataSources",
"qbusiness:ListWebExperiences",
"lambda:ListFunctions",
"lambda:GetFunction",
"ecs:ListClusters",
"ecs:ListServices",
"ecs:DescribeServices",
"ecs:DescribeTaskDefinition",
"events:DescribeEventBus",
"cloudtrail:ListTrails",
"cloudtrail:DescribeTrails",
"cloudtrail:GetEventSelectors",
"cloudtrail:LookupEvents",
"cloudwatch:ListMetrics",
"cloudwatch:GetMetricData",
"s3:ListAllMyBuckets",
"s3:GetBucketTagging",
"s3:GetLifecycleConfiguration",
"s3:GetBucketLocation",
"logs:DescribeLogGroups",
"dynamodb:ListTables",
"secretsmanager:ListSecrets",
"identitystore:GetUserId",
"identitystore:DescribeUser",
"identitystore:ListUsers",
"identitystore:ListGroups",
"identitystore:ListGroupMembershipsForMember",
"sso:ListInstances",
"sso:ListPermissionSets",
"sso:DescribePermissionSet",
"sso:ListAccountAssignments",
"sso:ListAccountAssignmentsForPrincipal",
"route53resolver:ListResolverQueryLogConfigs",
"route53resolver:ListResolverQueryLogConfigAssociations",
"ec2:DescribeVpcs",
"ec2:DescribeNetworkInterfaces",
"ec2:DescribeInstances",
"ec2:DescribeSecurityGroups",
"ec2:DescribeRouteTables",
"ec2:DescribeVpcPeeringConnections",
"elasticloadbalancing:DescribeLoadBalancers",
"elasticloadbalancing:DescribeTargetGroups",
"elasticloadbalancing:DescribeTargetHealth",
"elasticloadbalancing:DescribeListeners",
"elasticloadbalancing:DescribeLoadBalancerAttributes",
"wafv2:ListLoggingConfigurations",
"cloudfront:ListDistributions",
"cloudfront:GetDistributionConfig",
"route53:ListHostedZones",
"route53:ListResourceRecordSets",
"eks:ListClusters",
"eks:DescribeCluster",
"eks:ListPodIdentityAssociations",
"eks:DescribePodIdentityAssociation",
"rds:DescribeDBInstances",
"rds:DescribeDBClusters",
"redshift:DescribeClusters",
"es:ListDomainNames"
],
"Resource": "*"
},
{
"Sid": "ValkanDnsQueryLogs",
"Effect": "Allow",
"Action": [
"logs:FilterLogEvents"
],
"Resource": [
"arn:aws:logs:*:*:log-group:/aws/route53resolver/*",
"arn:aws:logs:*:*:log-group:/aws/route53resolver/*:*",
"arn:aws:logs:*:*:log-group:/valkan/*",
"arn:aws:logs:*:*:log-group:/valkan/*:*",
"arn:aws:logs:*:*:log-group:aws-waf-logs-*",
"arn:aws:logs:*:*:log-group:aws-waf-logs-*:*"
]
},
{
"Sid": "ValkanLoadBalancerAccessLogs",
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": "arn:aws:s3:::*",
"Condition": {
"StringLike": {
"s3:prefix": [
"AWSLogs/*/elasticloadbalancing/*",
"*/AWSLogs/*/elasticloadbalancing/*"
]
}
}
},
{
"Sid": "ValkanLoadBalancerAccessLogObjects",
"Effect": "Allow",
"Action": [
"s3:GetObject"
],
"Resource": "arn:aws:s3:::*/AWSLogs/*/elasticloadbalancing/*"
},
{
"Sid": "ValkanWafLogs",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::aws-waf-logs-*",
"arn:aws:s3:::aws-waf-logs-*/*"
]
},
{
"Sid": "ValkanApiGatewayStages",
"Effect": "Allow",
"Action": [
"apigateway:GET"
],
"Resource": [
"arn:aws:apigateway:*::/restapis",
"arn:aws:apigateway:*::/restapis/*/stages",
"arn:aws:apigateway:*::/apis",
"arn:aws:apigateway:*::/apis/*/stages"
]
},
{
"Sid": "ValkanAssumeMemberRoles",
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::*:role/ValkanDiscoveryReadOnly"
}
]
}Three groups here are optional, and Valkan degrades rather than fails without them:
- The managed-database actions (
rds:DescribeDBInstances,rds:DescribeDBClusters,redshift:DescribeClusters) cost you the Resources ▸ Databases inventory and the links from identities and agents to your databases; the scan itself still completes. - The Identity Center actions (
identitystore:List*,sso:List*andsso:DescribePermissionSet) cost you the people who sign in through Identity Center, their groups and their permission-set assignments; IAM users and roles are unaffected. Withoutsso:DescribePermissionSetalone, permission sets show by id instead of name. - Dropping
iam:ListGroupsForUsercosts group-inherited permissions — and since granting admin through a group is common, a user who is an admin that way will read as having no permissions at all.
Each missing grant is reported as a permission gap rather than an error, so you can add them later and rescan.
Keep the policy current. New Valkan releases sometimes add read-only actions to this policy, such as the log readers' wafv2:ListLoggingConfigurations, elasticloadbalancing:DescribeLoadBalancerAttributes, cloudfront:ListDistributions and apigateway:GET. Until you update it, each of those missing log-reader actions shows as one low-severity permission gap per account, naming the regions it affects. Replace the policy JSON with the version above. If you deployed through CloudFormation, update the stack; for an organization, update the StackSet so every member account gets the new template.
The ValkanAssumeMemberRoles statement is for an Organizations management account: it lets the role enter ValkanDiscoveryReadOnly in each member account. Without it, no member account is scanned. The member StackSet does not carry it, so updating the StackSet alone is not enough: update the management account's policy, or its CloudFormation stack, too. It names only a member role called ValkanDiscoveryReadOnly, so keep that role name in the StackSet.
ecs:ListServices is one of these later additions. Without it, Valkan lists your ECS clusters but not their services, and raises one high-severity permission gap per cluster. Those services stay out of your inventory until you update the policy and rescan.
One rds: grant covers RDS, Aurora, and standard DocumentDB and Neptune clusters: those answer on the RDS control plane, so there is no separate docdb: or neptune: permission to ask for. DocumentDB Elastic clusters and Neptune Analytics graphs are separate AWS services (docdb-elastic:, neptune-graph:) that this policy does not cover, so Valkan does not scan them.
Tags come back with the describe calls, so no tag-reading grant is needed either.
The two ValkanLoadBalancer… statements let Valkan read Application Load Balancer access logs for attack patterns (see step 8). They reach only keys under AWSLogs/<account>/elasticloadbalancing/, the path ALB writes to, with or without a bucket prefix. The grant names no bucket: the role can read a key matching that path in every bucket in the account, whoever wrote it, and in another account's bucket whose policy allows it. Valkan reads only the buckets your load balancers log to. Keep other data out of keys shaped like that path, or narrow Resource to your log buckets. No other object is readable.
Link IAM users to people
Valkan matches an IAM user to the person who owns it from the email it can read:
- a tag on the IAM user whose key is one of
valkan:gws-email,email,mail,user-email,user_email,owner-email,work-email,corp-email,company-email(and their_forms) and whose value is an email address (the key is not case-sensitive); the other tags are not read; - a user name that is an email at one of your company domains, such as
[email protected]; - a user name such as
niranjan_morniranjan-mis only a suggestion (niranjan.m@at your primary domain). An email at another domain is a suggestion too. A suggestion never links an account by itself; it appears under Needs review.
The tag read needs iam:ListUserTags, which the read-only policy already grants.
Whether an IAM user can sign in to the console needs iam:GetLoginProfile: Valkan reads only whether a console password exists, never the password, and judges console sign-in without MFA from it. If you attached the policy before this was added, attach it again; until then the scan shows a permission gap, IAM users are not judged for MFA, and their open MFA findings stay open, not closed.
The policy also grants iam:GetAccountSummary, iam:ListServiceSpecificCredentials, iam:ListSSHPublicKeys and iam:ListSigningCertificates. With them Valkan reads whether the root user has access keys and MFA, and which service-specific credentials (such as a Bedrock API key), SSH keys and signing certificates each IAM user holds: metadata only, never a secret or key material. If you attached the policy before these were added, attach it again; until then the scan shows a permission gap for each.
Valkan also looks each user up in the account's IAM Identity Center directory for a single sign-on email. It finds the directory itself with sso:ListInstances (and reads it with identitystore:GetUserId and identitystore:DescribeUser), all in the read-only policy; an account without Identity Center simply has none. If a lookup is denied or fails, the scan reports a coverage gap or an enumerator error and carries on without that email.
On a new or unused AWS account, the IAM console may reject newer Bedrock action names even though the policy is valid. If that happens, ask an AWS CLI user to attach the same policy, or open the Bedrock console and retry after its service catalog refreshes.
4. Connect and scan in Valkan
In Valkan, choose Integrations → Sources → Connect AWS. Use a role to assume is selected by default. Keep it, then provide:
- Role ARN:
arn:aws:iam::<account-id>:role/ValkanDiscoveryReadOnly - External ID: the value generated in step 2
- Bootstrap access key ID and secret: the values from step 1
- Region: the AWS region to begin scanning
- Choose Validate & continue.
- Resolve any missing permission probes.
- Complete the organization step and choose Scan now.
A scan can finish with permission gaps, but it will not have complete coverage until those gaps are resolved.
5. (Optional) See how VMs are reached from the internet
The role policy in step 3 includes the read-only actions that show how each VM is reached: ec2:DescribeSecurityGroups, ec2:DescribeRouteTables, ec2:DescribeVpcPeeringConnections, elasticloadbalancing:DescribeLoadBalancers, DescribeTargetGroups, DescribeTargetHealth and DescribeListeners, and route53:ListHostedZones and ListResourceRecordSets. Valkan reads security group rules open to the internet, whether the subnet routes to an internet gateway, the internet-facing load balancers (application, network and classic) that lead to the VM, the Route 53 names that point at it, and which databases it can connect to across VPC peering and security group rules. If you attached the policy before these were added, attach it again; until then a VM shows its exposure as unknown, with a permission gap per missing action, never as closed. Network ACLs, host firewalls and WAF rules are not evaluated.
6. (Optional) Enable DNS visibility
Shows which workloads in a VPC look up AI providers, as findings after each scan and in the DNS tab of the AWS source (Integrations → Sources, then the account). AWS leaves Route 53 Resolver query logging off by default.
The role from step 3, or from the CloudFormation stack, already has the five read-only actions Valkan needs. Turning logging on is a write, so you do it yourself, signed in to the account that owns the VPC as an identity that may create CloudWatch log groups and resource policies and Resolver query logging configurations. valkan-bootstrap and the Valkan role cannot. Repeat for each VPC.
Find the VPC ID and region
Use any of these:
- Valkan: after a scan, each VPC that Valkan sees no query logging for, in the regions you selected, raises a finding: Route53 Resolver query logging not enabled for VPC
vpc-…. - AWS console: choose the region, then open VPC → Your VPCs and copy the VPC ID. For the VPC of one VM, open EC2 → Instances → the instance.
- AWS CLI:
aws ec2 describe-vpcs --region <region> \
--query 'Vpcs[].{VpcId:VpcId,Name:Tags[?Key==`Name`]|[0].Value,Cidr:CidrBlock,Default:IsDefault}' \
--output tableValkan reads VPCs and their DNS query logs only in the regions selected for the connection.
Check for existing logging
aws route53resolver list-resolver-query-log-config-associations --region <region> \
--filters Name=ResourceId,Values=<vpc-id> \
--query 'ResolverQueryLogConfigAssociations[].ResolverQueryLogConfigId'An empty list ([]) means the VPC has no logging: continue below. Otherwise, look up where each configuration sends the logs:
aws route53resolver get-resolver-query-log-config --region <region> \
--resolver-query-log-config-id <config-id> \
--query 'ResolverQueryLogConfig.DestinationArn' --output text| Destination | What to do |
|---|---|
CloudWatch Logs group whose name starts with /aws/route53resolver/ or /valkan/ | Nothing. Valkan can already read it. |
| Any other CloudWatch Logs group | Allow the Valkan role logs:FilterLogEvents on arn:aws:logs:<region>:<account-id>:log-group:<log-group-name>:*, in a separate policy so that policy updates keep it. Until then Valkan reports a permission gap, and the VPC's not-enabled finding stays open. |
| S3 or Data Firehose | Valkan does not read these. Add a CloudWatch Logs configuration as below and keep the existing one. |
AWS does not deliver one VPC's logs to two destinations of the same type, so do not add a second CloudWatch Logs configuration.
Turn logging on
Replace the two placeholders, then run the block in one shell session. The region must be the VPC's region.
REGION=<region> # for example us-east-1
VPC_ID=<vpc-id> # for example vpc-0123456789abcdef0
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
LOG_GROUP=/aws/route53resolver/query-logs/$VPC_ID
aws logs create-log-group --region "$REGION" --log-group-name "$LOG_GROUP"
aws logs put-retention-policy --region "$REGION" \
--log-group-name "$LOG_GROUP" --retention-in-days 1
CONFIG_ID=$(aws route53resolver create-resolver-query-log-config --region "$REGION" \
--name "valkan-dns-logging-$VPC_ID" \
--destination-arn "arn:aws:logs:$REGION:$ACCOUNT_ID:log-group:$LOG_GROUP" \
--query 'ResolverQueryLogConfig.Id' --output text)
aws route53resolver associate-resolver-query-log-config --region "$REGION" \
--resolver-query-log-config-id "$CONFIG_ID" --resource-id "$VPC_ID"Retention. A scan reads up to the last 7 days, and the DNS tab offers the same range. One day keeps storage cost down, but nothing older can be read. Set 7 for the full range, or if the account is scanned less than once a day (the default is every 6 hours). On a very busy VPC more data can exceed the amount Valkan reads per scan, which raises a finding that the query-log scan was truncated. AWS charges for CloudWatch Logs ingestion and storage.
Check that it works
aws route53resolver list-resolver-query-log-config-associations --region "$REGION" \
--filters Name=ResourceId,Values="$VPC_ID" \
--query 'ResolverQueryLogConfigAssociations[].[Status,Error]' --output tableWait for ACTIVE, which parts of AWS's documentation call CREATED; either one means the association succeeded. CREATING means wait. On FAILED or ACTION_NEEDED, logging is not working and the second column says why, such as a missing log group or missing permission. Queries appear in the log group within a few minutes. Then scan the account again, or open the DNS tab. The tab shows only the first selected region; scans read every selected region.
Limits
- Only CloudWatch Logs destinations are read. A VPC that logs only to S3 or Firehose is reported as not read.
- Logging is not retroactive, and AWS does not log a query it answers from its cache.
- DNS shows that a workload (a VM, a VPC-attached Lambda function or an ECS task, otherwise an IP address) looked up a provider. It carries no process, identity or data volume. EKS pods show as their node.
- Lambda functions not attached to a VPC are not logged.
7. (Optional) Enable Bedrock model invocation logging
Standard Bedrock Runtime calls are observed from CloudTrail as hourly caller-to-model aggregates, with or without this step.
- Valkan does not read prompts or responses, even if you enable invocation logging.
- Valkan reads only whether logging is on in each selected region, and raises Bedrock model invocation logging disabled where it is off. It can't turn logging on because that is a write.
What logging stores
The command below writes one record per Bedrock Runtime call (Converse, ConverseStream, InvokeModel, InvokeModelWithResponseStream) to CloudWatch Logs in your account: the time, model, token counts and the caller's ARN. With textDataDeliveryEnabled set to true it also stores the prompts and responses, up to 100 KB each, which can contain personal or confidential data. Set it to false if you do not want them kept. Image, embedding, video and audio data are off.
CloudWatch keeps the records until you delete them or set a retention period (aws logs put-retention-policy), and charges for ingestion and storage. Decide who may read the log group.
Turn logging on
Do this signed in to the account Valkan scans, as an identity that may create log groups and IAM roles, pass the role to Bedrock (iam:PassRole) and set Bedrock's logging configuration. The setting is per account and per region.
First check each region. The command below replaces any configuration already there, so stop if this prints one: logging is already set up. null means there is none.
aws bedrock get-model-invocation-logging-configuration --region <region> \
--query loggingConfigOnce per account, create the role Bedrock uses to write the logs. It covers every region. If BedrockLoggingRole already exists, run the block without the create-role command: put-role-policy replaces BedrockLogsWrite with this version, which allows the log group in every region.
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
aws iam create-role --role-name BedrockLoggingRole \
--assume-role-policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"bedrock.amazonaws.com"},"Action":"sts:AssumeRole","Condition":{"StringEquals":{"aws:SourceAccount":"'"$ACCOUNT_ID"'"},"ArnLike":{"aws:SourceArn":"arn:aws:bedrock:*:'"$ACCOUNT_ID"':*"}}}]}'
aws iam put-role-policy --role-name BedrockLoggingRole --policy-name BedrockLogsWrite \
--policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["logs:CreateLogStream","logs:PutLogEvents"],"Resource":"arn:aws:logs:*:'"$ACCOUNT_ID"':log-group:/aws/bedrock/model-invocations:*"}]}'Once per region, replace <region> and run:
REGION=<region> # for example us-east-1
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
aws logs create-log-group --region "$REGION" \
--log-group-name /aws/bedrock/model-invocations
aws bedrock put-model-invocation-logging-configuration --region "$REGION" \
--logging-config '{
"cloudWatchConfig": {"logGroupName": "/aws/bedrock/model-invocations", "roleArn": "arn:aws:iam::'"$ACCOUNT_ID"':role/BedrockLoggingRole"},
"textDataDeliveryEnabled": true,
"imageDataDeliveryEnabled": false,
"embeddingDataDeliveryEnabled": false,
"videoDataDeliveryEnabled": false,
"audioDataDeliveryEnabled": false
}'If the last command says the role cannot be assumed, the new role is not ready yet: wait a few seconds and run it again. Run the get-… command above to confirm, then scan the account; the region's finding clears.
Bedrock needs its own role here (unlike DNS logging) because Bedrock itself writes the logs, not you.
8. (Optional) Turn on load balancer access logs
Valkan reads Application Load Balancer access logs for two attack patterns: one address getting many 401/403 responses, and one address getting a 429 and then requesting variants of the same path (/sso, /sso/, /sso/login). It reads the last day of logs, keeps no request, and drops query strings first.
Turn access logging on for each ALB to check (EC2 → Load balancers → the ALB → Attributes → Monitoring → Access logs), into a bucket in the same region. The role policy in step 3 already includes the reads. If you attached it before they were added, attach it again; until then each region shows a permission gap, not a clean result.
AWS WAF logs are read for the same patterns, where you already send them: an S3 bucket or CloudWatch Logs group, which AWS requires to be named aws-waf-logs-*. Nothing needs to change. The ValkanWafLogs statement and the aws-waf-logs-* log groups in ValkanDnsQueryLogs reach only those names. A web ACL that logs only to Data Firehose is reported as not checked.
CloudFront standard logs are read where each distribution already writes them. Their bucket and prefix are yours to choose, so the step 3 policy can find them but not read them. After a scan, each distribution whose logs Valkan may not read shows a permission gap with a statement granting exactly that bucket and prefix; add it to the role's policy to have those logs checked. A bucket in another account also needs its bucket policy to allow the role. A distribution without standard logging, including one using standard logging v2, is listed as not checked.
API Gateway access logs are read the same way: the ValkanApiGatewayStages statement finds each stage's log group and format (apigateway:GET is API Gateway's read action, limited to the API lists and each API's stage list, not integrations, authorizers or exports; a stage list also returns stage variables, which Valkan does not keep), and a group the role may not read shows a permission gap with a statement for exactly that group. The stage's log format must include $context.identity.sourceIp, $context.status, $context.path and $context.requestTime; a stage without them is reported as not checked.