Skip to content

Restructure obsy samples#1654

Merged
rajeshkumarravi merged 8 commits into
awslabs:mainfrom
BharathiSrini:restructure-obsy-samples
Jun 12, 2026
Merged

Restructure obsy samples#1654
rajeshkumarravi merged 8 commits into
awslabs:mainfrom
BharathiSrini:restructure-obsy-samples

Conversation

@BharathiSrini

@BharathiSrini BharathiSrini commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Amazon Bedrock AgentCore Samples Pull Request

Important

  1. We strictly follow a issue-first approach, please first open an issue relating to this Pull Request.
  2. Once this Pull Request is ready for review please attach review ready label to it. Only PRs with review ready will be reviewed.

Issue number:

Add agents-on-ecs and agent-in-lambda samples under agents-hosted-outside-runtime

Restructures 03-integrations/agents-hosted-outside-runtime to add two new patterns:

  1. Moves observability-fullstack-examples/agentic-sales-analyst → agents-on-ecs/agentic-sales-analyst,
    giving the ECS-hosted multi-agent sample a proper home under agents-hosted-outside-runtime.

  2. Adds agents-on-aws-lambda/02-agent-in-lambda: a new sample showing how to host a Strands agent
    directly inside AWS Lambda with full Gen AI observability via the ADOT managed Lambda layer.
    Existing lambda-invokes-runtime content is moved into 01-lambda-invokes-runtime/ and given its
    own README explaining the span-suppression pattern.

The 02-agent-in-lambda sample fixes a version-conflict bug (strands-agents bundles its own
opentelemetry packages that shadow the ADOT layer's copies) by adding aws-opentelemetry-distro
to requirements.txt. It also adds _CWJsonSpanExporter to lambda_agent.py, which writes each OTel
span as a compact single-line JSON to the Lambda CloudWatch log group so that AgentCore batch
evaluation can read Gen AI sessions without requiring a separate /aws/spans sink.

User experience

▎ Before: agents-hosted-outside-runtime only showed the "Lambda invokes a runtime" pattern. There was no sample for running an agent directly inside Lambda, and the ECS-based
agentic-sales-analyst lived under the unrelated observability-fullstack-examples folder.

▎ After:
▎ - agents-on-ecs/agentic-sales-analyst — the full-stack ECS multi-agent sample is discoverable under the right parent folder.
▎ - agents-on-aws-lambda/01-lambda-invokes-runtime/ — the existing pattern (Lambda triggers a hosted runtime agent) is preserved with an updated README explaining the span-suppression problem
and the ADOT fix for it.
▎ - agents-on-aws-lambda/02-agent-in-lambda/ — new end-to-end sample: deploy.py creates the Lambda with the ADOT layer attached, invoke.py generates 5 sessions, evaluate.py runs a
Builtin.GoalSuccessRate batch evaluation job against the Lambda CloudWatch log group, and cleanup.py tears everything down. Console screenshots walk through enabling Application Signals,
attaching the ADOT layer, and setting the required environment variables.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • Add your name to CONTRIBUTORS.md
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Are you uploading a dataset?
  • Have you documented Introduction, Architecture Diagram, Prerequisites, Usage, Sample Prompts, and Clean Up steps in your example README?
  • I agree to resolve any issues created for this example in the future.
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

…n-lambda sample

- Move observability-fullstack-examples/agentic-sales-analyst → agents-on-ecs/agentic-sales-analyst (git rename preserves history)
- Restructure agents-on-aws-lambda into two subfolders:
  - 01-lambda-invokes-runtime/: existing Lambda→AgentCore runtime pattern
  - 02-agent-in-lambda/: new pattern — Strands agent wrapped inside Lambda with ADOT observability
- New 02-agent-in-lambda sample includes:
  - lambda_agent.py: Strands Agent handler
  - requirements.txt: strands-agents + aws-opentelemetry-distro
  - build.sh: SAM container build producing Lambda-compatible ZIP
  - images/: console screenshots for X-Ray, ADOT layer, env vars, permissions
  - README.md: step-by-step setup guide with console screenshots, env var table, IAM policy,
    and explanation of the Lambda-suppresses-spans problem with requirements for the
    Lambda-invokes-runtime pattern
- Add top-level agents-on-aws-lambda/README.md comparing both patterns
…el via pip

- requirements.txt: remove aws-opentelemetry-distro; only strands-agents needed
- build.sh: remove opentelemetry-instrument copy step; ZIP contains only strands-agents
- lambda_agent.py: update docstring to reflect layer-based setup; clean up logging
- README.md: rewrite setup steps for managed layer approach:
  - add ADOT layer ARN table for all major regions (account 901920570463)
  - AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument (layer path, not /var/task/)
  - AGENT_OBSERVABILITY_ENABLED=true for Strands Gen AI spans
  - Option A (manual ARN) and Option B (Application Signals console toggle)
  - retain console screenshots, IAM policy, test CLI invocation, trace viewing steps
  - retain Lambda-invokes-runtime span-suppression pattern explanation
… and evaluation pipeline

- Add aws-opentelemetry-distro to requirements.txt so the bundled OTel
  packages are compatible with the ADOT layer's startup code (fixes
  ImportError: cannot import name 'LogData' from opentelemetry.sdk._logs)
- Add _CWJsonSpanExporter to lambda_agent.py: writes each OTel span as a
  compact single-line JSON to stdout to the Lambda CloudWatch log group,
  enabling AgentCore batch evaluation to read Gen AI sessions without a
  separate /aws/spans sink
- Add deploy.py, invoke.py, evaluate.py, cleanup.py scripts
- evaluate.py: starts Builtin.GoalSuccessRate batch evaluation using the
  Lambda log group as the cloudWatchLogs data source
- Gitignore lambda_config.json (runtime artifact)

Tested end-to-end: 5 Lambda invocations then evaluation COMPLETED
@github-actions github-actions Bot added the 03-integrations 03-integrations label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

Latest scan for commit: 709c201 | Updated: 2026-06-12 00:33:17 UTC

Security Scan Results

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-06-12T00:33:02+00:00
  • ASH version: 3.0.0

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

Column Explanations:

Severity Levels (S/C/H/M/L/I):

  • Suppressed (S): Security findings that have been explicitly suppressed/ignored and don't affect the scanner's pass/fail status
  • Critical (C): The most severe security vulnerabilities requiring immediate remediation (e.g., SQL injection, remote code execution)
  • High (H): Serious security vulnerabilities that should be addressed promptly (e.g., authentication bypasses, privilege escalation)
  • Medium (M): Moderate security risks that should be addressed in normal development cycles (e.g., weak encryption, input validation issues)
  • Low (L): Minor security concerns with limited impact (e.g., information disclosure, weak recommendations)
  • Info (I): Informational findings for awareness with minimal security risk (e.g., code quality suggestions, best practice recommendations)

Other Columns:

  • Time: Duration taken by each scanner to complete its analysis
  • Action: Total number of actionable findings at or above the configured severity threshold that require attention

Scanner Results:

  • PASSED: Scanner found no security issues at or above the configured severity threshold - code is clean for this scanner
  • FAILED: Scanner found security vulnerabilities at or above the threshold that require attention and remediation
  • MISSING: Scanner could not run because required dependencies/tools are not installed or available
  • SKIPPED: Scanner was intentionally disabled or excluded from this scan
  • ERROR: Scanner encountered an execution error and could not complete successfully

Severity Thresholds (Thresh Column):

  • CRITICAL: Only Critical severity findings cause scanner to fail
  • HIGH: High and Critical severity findings cause scanner to fail
  • MEDIUM (MED): Medium, High, and Critical severity findings cause scanner to fail
  • LOW: Low, Medium, High, and Critical severity findings cause scanner to fail
  • ALL: Any finding of any severity level causes scanner to fail

Threshold Source: Values in parentheses indicate where the threshold is configured:

  • (g) = global: Set in the global_settings section of ASH configuration
  • (c) = config: Set in the individual scanner configuration section
  • (s) = scanner: Default threshold built into the scanner itself

Statistics calculation:

  • All statistics are calculated from the final aggregated SARIF report
  • Suppressed findings are counted separately and do not contribute to actionable findings
  • Scanner status is determined by comparing actionable findings to the threshold
Scanner S C H M L I Time Action Result Thresh
bandit 0 1 0 0 63 0 1.4s 1 FAILED MED (g)
cdk-nag 0 9 0 0 0 15 12.7s 9 FAILED MED (g)
cfn-nag 0 0 0 12 0 0 6.9s 12 FAILED MED (g)
checkov 6 4 0 0 0 0 9.6s 4 FAILED MED (g)
detect-sec… 0 0 0 0 0 0 1.4s 0 PASSED MED (g)
grype 0 42 0 33 5 0 52.0s 75 FAILED MED (g)
npm-audit 0 0 0 0 0 0 912ms 0 PASSED MED (g)
opengrep 0 0 0 0 0 0 <1ms 0 SKIPPED MED (g)
semgrep 0 0 0 0 0 0 <1ms 0 MISSING MED (g)
syft 0 0 0 0 0 0 2.7s 0 PASSED MED (g)

Detailed Findings

Show 101 actionable findings

Finding 1: B608

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B608
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/strands_agentcore_runtime.py:61-118

Description:
Possible SQL injection vector through string-based query construction.

Code Snippet:

schema = discover_schema()
    return f"""
You are a sales analyst for our company. You analyze our internal sales data and provide market context.

SCOPE: Only answer questions about our company's sales data. For unrelated questions, decline politely.

TOOLS:
1. execute_sql_query - Query our sales database
2. search_web - Get market context for our sales performance

DATABASE SCHEMA:
{schema}

CRITICAL RULES:
1. ALWAYS use execute_sql_query for questions about our internal sales data - never just describe what you would query
2. Use search_web only if market context is needed to enhance database results
3. Use only SELECT queries on tables shown in schema above
4. Sample data shows only limited examples - ALWAYS query to discover all actual values and data patterns in the database
5. Database contains data through 2025 - always query before saying data doesn't exist
6. NEVER include SQL queries in the content field - only provide business insights and analysis
7. MANDATORY: You MUST call tools, not describe what tools you would use

WORKFLOW:
1. Analyze the question to determine what information is needed
2. MUST call execute_sql_query if internal sales data is required
3. Only call search_web if market context is needed to enhance database results
4. Return JSON response with insights from tools used

🚨 CRITICAL: ALWAYS RETURN JSON FORMAT 🚨
EVERY response must be valid JSON - NO EXCEPTIONS
EVEN when declining requests, you MUST return JSON format

JSON OUTPUT REQUIRED:
{{
  "content": "Your response text here",
  "sources": []
}}

EXAMPLES:
- Sales question: {{"content": "Analysis with data", "sources": [{{"type": "database", "name": "Sales Database"}}]}}
- Out of scope: {{"content": "I can only analyze our company's sales data", "sources": []}}
- Error: {{"content": "Unable to process request", "sources": []}}

CRITICAL JSON REQUIREMENTS:
- Output ONLY valid JSON starting with {{ and ending with }}
- NO text before or after the JSON object
- ALWAYS include "content" field with your response as a string
- ALWAYS include "sources" array (empty if no tools used)
- For database sources: {{"type": "database", "name": "Sales Database"}}
- For web sources: {{"type": "web", "title": "Exact title from search result", "url": "Exact URL from search result"}}
- Never fabricate sources - use exact data from tool results

🔥 ABSOLUTE REQUIREMENT 🔥
Your response must be EXACTLY: {{ "content": "...", "sources": [...] }}
NO PLAIN TEXT RESPONSES ALLOWED - SYSTEM WILL FAIL
NEVER include SQL statements in the content - only business analysis
"""

Finding 2: CFN_NAG_W11

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W11
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/02-iam.yaml:25

Description:
IAM role should not allow * resource on its permissions policy


Finding 3: CFN_NAG_W28

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W28
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/02-iam.yaml:11

Description:
Resource found with an explicit name, this disallows updates that require replacement of this resource


Finding 4: CFN_NAG_W28

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W28
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/02-iam.yaml:25

Description:
Resource found with an explicit name, this disallows updates that require replacement of this resource


Finding 5: CFN_NAG_W28

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W28
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/03-ecr.yaml:11

Description:
Resource found with an explicit name, this disallows updates that require replacement of this resource


Finding 6: CFN_NAG_W84

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W84
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:166

Description:
CloudWatchLogs LogGroup should specify a KMS Key Id to encrypt the log data


Finding 7: CFN_NAG_W28

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W28
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:39

Description:
Resource found with an explicit name, this disallows updates that require replacement of this resource


Finding 8: CFN_NAG_W28

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W28
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:69

Description:
Resource found with an explicit name, this disallows updates that require replacement of this resource


Finding 9: CFN_NAG_W28

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W28
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:113

Description:
Resource found with an explicit name, this disallows updates that require replacement of this resource


Finding 10: CFN_NAG_W35

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W35
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:11

Description:
S3 Bucket should have access logging configured


Finding 11: CFN_NAG_W41

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W41
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:11

Description:
S3 Bucket should have encryption option set


Finding 12: CFN_NAG_W5

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W5
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:69

Description:
Security Groups found with cidr open to world on egress


Finding 13: CFN_NAG_W9

  • Severity: MEDIUM
  • Scanner: cfn-nag
  • Rule ID: CFN_NAG_W9
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:39

Description:
Security Groups found with ingress cidr that is not /32


Finding 14: CKV_AWS_18

  • Severity: HIGH
  • Scanner: checkov
  • Rule ID: CKV_AWS_18
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:10-18

Description:
Ensure the S3 bucket has access logging enabled

Code Snippet:

ALBLogsBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub ${ProjectName}-alb-logs-${AWS::AccountId}
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true

Finding 15: CKV_AWS_21

  • Severity: HIGH
  • Scanner: checkov
  • Rule ID: CKV_AWS_21
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:10-18

Description:
Ensure the S3 bucket has versioning enabled

Code Snippet:

ALBLogsBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub ${ProjectName}-alb-logs-${AWS::AccountId}
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true

Finding 16: CKV_AWS_103

  • Severity: HIGH
  • Scanner: checkov
  • Rule ID: CKV_AWS_103
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:149-163

Description:
Ensure that Load Balancer Listener is using at least TLS v1.2

Code Snippet:

Listener:  # checkov:skip=CKV_AWS_103,CKV_AWS_2:Demo application uses HTTP for simplicity
    Type: AWS::ElasticLoadBalancingV2::Listener
    Metadata:
      cfn_nag:
        rules_to_suppress:
          - id: W56
            reason: >-
              Demo application uses HTTP for simplicity; use HTTPS with ACM certificate in production
    Properties:
      LoadBalancerArn: !Ref ALB
      Port: 80
      Protocol: HTTP
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref TargetGroup

Finding 17: CKV_AWS_2

  • Severity: HIGH
  • Scanner: checkov
  • Rule ID: CKV_AWS_2
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:149-163

Description:
Ensure ALB protocol is HTTPS

Code Snippet:

Listener:  # checkov:skip=CKV_AWS_103,CKV_AWS_2:Demo application uses HTTP for simplicity
    Type: AWS::ElasticLoadBalancingV2::Listener
    Metadata:
      cfn_nag:
        rules_to_suppress:
          - id: W56
            reason: >-
              Demo application uses HTTP for simplicity; use HTTPS with ACM certificate in production
    Properties:
      LoadBalancerArn: !Ref ALB
      Port: 80
      Protocol: HTTP
      DefaultActions:
        - Type: forward
          TargetGroupArn: !Ref TargetGroup

Finding 18: AwsSolutions-VPC7

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-VPC7
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/01-network.yaml:9

Description:
The VPC does not have an associated Flow Log.

Exception Reason: N/A

Code Snippet:

Resources:
  VPC:
    Metadata:
      cfn_nag:
        rules_to_suppress:
          - id: W60
            reason: Demo/tutorial VPC does not require flow logs; enable VPC Flow Logs in production
    Properties:
      CidrBlock: 10.0.0.0/16
      EnableDnsHostnames: true
      EnableDnsSupport: true
      Tags:
        - Key: Name
          Value:
            Fn::Sub: ${ProjectName}-vpc
    Type: AWS::EC2::VPC

Finding 19: AwsSolutions-IAM4

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-IAM4
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/02-iam.yaml:9

Description:
The IAM user, role, or group uses AWS managed policies.

Exception Reason: N/A

Code Snippet:

Resources:
  ExecutionRole:
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: ecs-tasks.amazonaws.com
        Version: '2012-10-17'
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
      RoleName:
        Fn::Sub: ${ProjectName}-execution-role
    Type: AWS::IAM::Role

Finding 20: AwsSolutions-IAM5

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-IAM5
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/02-iam.yaml:23

Description:
The IAM entity contains wildcard permissions and does not have a cdk-nag rule suppression with evidence for those permission.

Exception Reason: N/A

Code Snippet:

Resources:
  TaskRole:
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: ecs-tasks.amazonaws.com
        Version: '2012-10-17'
      Policies:
        - PolicyDocument:
            Statement:
              - Action:
                  - bedrock:InvokeModel
                  - bedrock:InvokeModelWithResponseStream
                Effect: Allow
                Resource: arn:aws:bedrock:*::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0
            Version: '2012-10-17'
          PolicyName: BedrockAccess
        - PolicyDocument:
            Statement:
              - Action:
                  - bedrock-agentcore:CreateMemory
                  - bedrock-agentcore:GetMemory
                  - bedrock-agentcore:ListMemories
                  - bedrock-agentcore:UpdateMemory
                  - bedrock-agentcore:DeleteMemory
                  - bedrock-agentcore:CreateEvent
                  - bedrock-agentcore:GetLastKTurns
                  - bedrock-agentcore:ListEvents
                  - bedrock-agentcore:GetEvent
                Effect: Allow
                Resource: '*'
            Version: '2012-10-17'
          PolicyName: AgentCoreMemory
        - PolicyDocument:
            Statement:
              - Action:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:PutLogEvents
                  - xray:PutTraceSegments
                  - xray:PutTelemetryRecords
                Effect: Allow
                Resource: '*'
            Version: '2012-10-17'
          PolicyName: Observability
      RoleName:
        Fn::Sub: ${ProjectName}-task-role
    Type: AWS::IAM::Role

Finding 21: AwsSolutions-IAM5

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-IAM5
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/common/02-iam.yaml:23

Description:
The IAM entity contains wildcard permissions and does not have a cdk-nag rule suppression with evidence for those permission.

Exception Reason: N/A

Code Snippet:

Resources:
  TaskRole:
    Properties:
      AssumeRolePolicyDocument:
        Statement:
          - Action: sts:AssumeRole
            Effect: Allow
            Principal:
              Service: ecs-tasks.amazonaws.com
        Version: '2012-10-17'
      Policies:
        - PolicyDocument:
            Statement:
              - Action:
                  - bedrock:InvokeModel
                  - bedrock:InvokeModelWithResponseStream
                Effect: Allow
                Resource: arn:aws:bedrock:*::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0
            Version: '2012-10-17'
          PolicyName: BedrockAccess
        - PolicyDocument:
            Statement:
              - Action:
                  - bedrock-agentcore:CreateMemory
                  - bedrock-agentcore:GetMemory
                  - bedrock-agentcore:ListMemories
                  - bedrock-agentcore:UpdateMemory
                  - bedrock-agentcore:DeleteMemory
                  - bedrock-agentcore:CreateEvent
                  - bedrock-agentcore:GetLastKTurns
                  - bedrock-agentcore:ListEvents
                  - bedrock-agentcore:GetEvent
                Effect: Allow
                Resource: '*'
            Version: '2012-10-17'
          PolicyName: AgentCoreMemory
        - PolicyDocument:
            Statement:
              - Action:
                  - logs:CreateLogGroup
                  - logs:CreateLogStream
                  - logs:PutLogEvents
                  - xray:PutTraceSegments
                  - xray:PutTelemetryRecords
                Effect: Allow
                Resource: '*'
            Version: '2012-10-17'
          PolicyName: Observability
      RoleName:
        Fn::Sub: ${ProjectName}-task-role
    Type: AWS::IAM::Role

Finding 22: AwsSolutions-S1

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-S1
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:9

Description:
The S3 Bucket has server access logs disabled.

Exception Reason: N/A

Code Snippet:

Resources:
  ALBLogsBucket:
    Properties:
      BucketName:
        Fn::Sub: ${ProjectName}-alb-logs-${AWS::AccountId}
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true
    Type: AWS::S3::Bucket

Finding 23: AwsSolutions-S10

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-S10
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:9

Description:
The S3 Bucket or bucket policy does not require requests to use SSL.

Exception Reason: N/A

Code Snippet:

Resources:
  ALBLogsBucket:
    Properties:
      BucketName:
        Fn::Sub: ${ProjectName}-alb-logs-${AWS::AccountId}
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true
    Type: AWS::S3::Bucket

Finding 24: AwsSolutions-S10

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-S10
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:19

Description:
The S3 Bucket or bucket policy does not require requests to use SSL.

Exception Reason: N/A

Code Snippet:

Resources:
  ALBLogsBucketPolicy:
    Properties:
      Bucket:
        Ref: ALBLogsBucket
      PolicyDocument:
        Statement:
          - Action: s3:PutObject
            Effect: Allow
            Principal:
              Service: logdelivery.elasticloadbalancing.amazonaws.com
            Resource:
              Fn::Sub: arn:aws:s3:::${ALBLogsBucket}/AWSLogs/${AWS::AccountId}/*
          - Action: s3:GetBucketAcl
            Effect: Allow
            Principal:
              Service: logdelivery.elasticloadbalancing.amazonaws.com
            Resource:
              Fn::Sub: arn:aws:s3:::${ALBLogsBucket}
        Version: '2012-10-17'
    Type: AWS::S3::BucketPolicy

Finding 25: AwsSolutions-EC23

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-EC23
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/cluster.yaml:37

Description:
The Security Group allows for 0.0.0.0/0 or ::/0 inbound access.

Exception Reason: N/A

Code Snippet:

Resources:
  ALBSecurityGroup:
    Metadata:
      cfn_nag:
        rules_to_suppress:
          - id: W2
            reason: Demo ALB requires public HTTP access from internet; restrict to specific CIDRs in production
          - id: W5
            reason: Demo ALB security group allows ingress from 0.0.0.0/0 for public accessibility; restrict in production
          - id: W40
            reason: ALB requires broad outbound access for health checks and ECS task routing; restrict in production
    Properties:
      GroupDescription: ALB security group
      GroupName:
        Fn::Sub: ${ProjectName}-alb-sg
      SecurityGroupEgress:
        - CidrIp: 0.0.0.0/0
          Description: Allow all outbound traffic for ALB functionality
          IpProtocol: -1
      SecurityGroupIngress:
        - CidrIp: 0.0.0.0/0
          Description: Allow HTTP from internet (demo application)
          FromPort: 80
          IpProtocol: tcp
          ToPort: 80
      VpcId:
        Fn::ImportValue:
          Fn::Sub:
            Fn::ENV: ${ProjectName}-vpc-id
    Type: AWS::EC2::SecurityGroup

Finding 26: AwsSolutions-ECS2

  • Severity: HIGH
  • Scanner: cdk-nag
  • Rule ID: AwsSolutions-ECS2
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/deployment/ecs/service.yaml:86

Description:
The ECS Task Definition includes a container definition that directly specifies environment variables.

Exception Reason: N/A

Code Snippet:

Resources:
  TaskDefinition:
    DependsOn:
      - EFSMountTarget1
      - EFSMountTarget2
    Properties:
      ContainerDefinitions:
        - Environment:
            - Name: POSTGRES_DB
              Value: sales_db
            - Name: POSTGRES_USER
              Value: postgres
            - Name: POSTGRES_PASSWORD
              Value: postgres
          Essential: true
          HealthCheck:
            Command:
              - CMD-SHELL
              - pg_isready -U postgres
            Interval: 10
            Retries: 5
            StartPeriod: 30
            Timeout: 5
          Image:
            Fn::Sub: ${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/${ProjectName}:postgres-latest
          LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-group:
                Fn::ImportValue:
                  Fn::Sub:
                    Fn::ENV: ${ProjectName}-log-group
              awslogs-region:
                Ref: AWS::Region
              awslogs-stream-prefix: postgres
          MountPoints:
            - ContainerPath: /var/lib/postgresql/data
              SourceVolume: postgres-data
          Name: postgres
        - DependsOn:
            - Condition: HEALTHY
              ContainerName: postgres
          Environment:
            - Name: AWS_REGION
              Value:
                Ref: AWS::Region
            - Name: DEPLOYMENT_MODE
              Value: ecs
            - Name: PROJECT_NAME
              Value:
                Ref: ProjectName
            - Name: DATABASE_URL
              Value: postgresql://postgres:postgres@localhost:5432/sales_db
            - Name: BRAVE_SEARCH_API_KEY
              Value:
                Ref: BraveSearchAPIKey
            - Name: AGENT_OBSERVABILITY_ENABLED
              Value: 'true'
            - Name: OTEL_PYTHON_DISTRO
              Value: aws_distro
            - Name: OTEL_PYTHON_CONFIGURATOR
              Value: aws_configurator
            - Name: OTEL_EXPORTER_OTLP_PROTOCOL
              Value: http/protobuf
            - Name: OTEL_LOGS_EXPORTER
              Value: otlp
            - Name: OTEL_EXPORTER_OTLP_LOGS_PROTOCOL
              Value: http/protobuf
            - Name: OTEL_EXPORTER_OTLP_LOGS_HEADERS
              Value:
                Fn::Sub: x-aws-log-group=/aws/bedrock-agentcore/runtimes/${ProjectName},x-aws-log-stream=runtime-logs,x-aws-metric-namespace=bedrock-agentcore
            - Name: OTEL_SERVICE_NAME
              Value:
                Ref: ProjectName
            - Name: OTEL_RESOURCE_ATTRIBUTES
              Value:
                Fn::Sub: service.name=${ProjectName},aws.log.group.names=/aws/bedrock-agentcore/runtimes/${ProjectName}
          Essential: true
          HealthCheck:
            Command:
              - CMD-SHELL
              - curl -f http://localhost:8080/health || exit 1
            Interval: 30
            Retries: 3
            StartPeriod: 60
            Timeout: 5
          Image:
            Ref: BackendImage
          LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-group:
                Fn::ImportValue:
                  Fn::Sub:
                    Fn::ENV: ${ProjectName}-log-group
              awslogs-region:
                Ref: AWS::Region
              awslogs-stream-prefix: backend
          Name: backend
          PortMappings:
            - ContainerPort: 8080
        - DependsOn:
            - Condition: HEALTHY
              ContainerName: backend
          Environment:
            - Name: REACT_APP_API_URL
              Value: http://localhost:8080
          Essential: true
          HealthCheck:
            Command:
              - CMD-SHELL
              - curl -f http://localhost:3000 || exit 1
            Interval: 30
            Retries: 3
            StartPeriod: 60
            Timeout: 5
          Image:
            Ref: FrontendImage
          LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-group:
                Fn::ImportValue:
                  Fn::Sub:
                    Fn::ENV: ${ProjectName}-log-group
              awslogs-region:
                Ref: AWS::Region
              awslogs-stream-prefix: frontend
          Name: frontend
          PortMappings:
            - ContainerPort: 3000
      Cpu: '2048'
      ExecutionRoleArn:
        Fn::ImportValue:
          Fn::Sub:
            Fn::ENV: ${ProjectName}-execution-role-arn
      Family:
        Fn::Sub: ${ProjectName}-task
      Memory: '4096'
      NetworkMode: awsvpc
      RequiresCompatibilities:
        - FARGATE
      TaskRoleArn:
        Fn::ImportValue:
          Fn::Sub:
            Fn::ENV: ${ProjectName}-task-role-arn
      Volumes:
        - EFSVolumeConfiguration:
            FilesystemId:
              Ref: EFSFileSystem
            TransitEncryption: ENABLED
          Name: postgres-data
    Type: AWS::ECS::TaskDefinition

Finding 27: GHSA-mw96-cpmx-2vgc-rollup

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-mw96-cpmx-2vgc-rollup
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: rollup, version 2.79.2 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 28: GHSA-rp65-9cf3-cjxr-nth-check

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-rp65-9cf3-cjxr-nth-check
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: nth-check, version 1.0.2 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 29: GHSA-3w6x-2g7m-8v23-axios

  • Severity: MEDIUM
  • Scanner: grype
  • Rule ID: GHSA-3w6x-2g7m-8v23-axios
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A medium vulnerability in npm package: axios, version 1.12.2 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 30: GHSA-w9j2-pvgh-6h63-axios

  • Severity: MEDIUM
  • Scanner: grype
  • Rule ID: GHSA-w9j2-pvgh-6h63-axios
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A medium vulnerability in npm package: axios, version 1.12.2 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 31: GHSA-87r5-mp6g-5w5j-jsonpath

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-87r5-mp6g-5w5j-jsonpath
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: jsonpath, version 1.1.1 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 32: GHSA-7fh5-64p2-3v2j-postcss

  • Severity: MEDIUM
  • Scanner: grype
  • Rule ID: GHSA-7fh5-64p2-3v2j-postcss
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A medium vulnerability in npm package: postcss, version 7.0.39 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 33: GHSA-q8qp-cvcw-x6jj-axios

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-q8qp-cvcw-x6jj-axios
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: axios, version 1.12.2 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 34: GHSA-xpqw-6gx7-v673-svgo

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-xpqw-6gx7-v673-svgo
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: svgo, version 2.8.0 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 35: GHSA-5m6q-g25r-mvwx-node-forge

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-5m6q-g25r-mvwx-node-forge
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: node-forge, version 1.3.3 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 36: GHSA-w7jw-789q-3m8p-shell-quote

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-w7jw-789q-3m8p-shell-quote
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A critical vulnerability in npm package: shell-quote, version 1.8.3 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 37: GHSA-rf6f-7fwh-wjgh-flatted

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-rf6f-7fwh-wjgh-flatted
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A high vulnerability in npm package: flatted, version 3.3.3 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 38: GHSA-4v9v-hfq4-rm2v-webpack-dev-server

  • Severity: MEDIUM
  • Scanner: grype
  • Rule ID: GHSA-4v9v-hfq4-rm2v-webpack-dev-server
  • Location: 03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json:1

Description:
A medium vulnerability in npm package: webpack-dev-server, version 4.15.2 was found at: /03-integrations/agents-hosted-outside-runtime/agents-on-ecs/agentic-sales-analyst/client/package-lock.json


Finding 39: GHSA-6c59-mwgh-r2x6-jsonpath

@rajeshkumarravi

Copy link
Copy Markdown
Collaborator

Bharathi, does this also include renaming "observability" to "3P-observability" and deleting "simple-dual-obsy"?

@rajeshkumarravi rajeshkumarravi merged commit 2745264 into awslabs:main Jun 12, 2026
7 of 8 checks passed
@rajeshkumarravi

Copy link
Copy Markdown
Collaborator

TY Bharathi. Commits merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

03-integrations 03-integrations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants