aws / aws/bedrock-agentcore-sdk-python

feat: Support Secrets Manager references in runtime environment variables

オープン
#396 コメント 0 件 リアクション 13 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
761
フォーク
147
平均マージ
1日 23時間
マージ済み PR(30日)
7

説明

## Problem

The environment_variables block on AgentCore Agent Runtime only accepts plaintext values. There is no mechanism to reference secrets from AWS Secrets Manager (or SSM Parameter Store) that get resolved at container start time.
This is a gap compared to other AWS container services. For example, ECS task definitions support valueFrom on container environment variables, which resolves Secrets Manager ARNs or SSM Parameter Store paths when the container starts — without ever exposing the secret value in the task definition, Terraform state, or the AWS console.

## Use Case

When integrating third-party services that require credentials via environment variables (observability platforms, external APIs, etc.), the current options are:

1. Plaintext env vars — credentials are visible in Terraform state, terraform plan output, the AgentCore console, and the AWS API. This is undesirable for production workloads with compliance requirements.
2. Runtime secret fetching — application code fetches secrets from Secrets Manager at startup and sets env vars programmatically. This works but introduces timing issues when platform-level components (e.g., ADOT auto-instrumentation) read environment variables before application code has a chance to set them.

Neither option provides the same security and ergonomics that ECS users already have.

## Proposed Solution

Support an optional secret reference syntax in environment_variables that resolves Secrets Manager (and ideally SSM Parameter Store) values at container start, before any application code or auto-instrumentation runs. For example:

```python
# Pseudocode
environment_variables = {
"MY_API_KEY": {"secret_arn": "arn:aws:secretsmanager:us-east-1:123456789:secret:my-key"},
"SOME_CONFIG": "plaintext-value", # existing behavior preserved }
```

This would:
- Keep secrets out of Terraform state and API responses
- Ensure secrets are available as env vars before any process (including auto-instrumentation) starts
- Align with the ECS valueFrom pattern that AWS users are already familiar with

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

実装ファイルやテストは指定されていません。まず AgentCore Agent Runtime の environment_variables スキーマと関連するテストを見つけ、次に提案されている secret_arn の形状を ECS の valueFrom パターンと比較します。完了の条件は、平文の値が引き続き機能し、対応している Secrets Manager または SSM の参照がコンテナの起動前に解決され、シークレットの値が公開されないことです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
aws, python
領域
cloud, security
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。