Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Feature Request: Add support for AWS IAM roles (ECS Task Role / EC2 Instance Profile) for SQS authentication

未关闭
#463 4 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
冷清
技术栈
aws, go
领域
backend, cloud

调研方向

从 internal/config/mqconfig_aws.go 和 issue 中引用的 IsConfigured() 方法开始,然后追踪配置验证在哪里抛出 'message queue configuration is required',以及 SQS 客户端在哪里构建(以确认它依赖 AWS SDK 的默认凭证链)。找到覆盖 AWSSQSConfig 的配置验证测试,并为 IAM 角色环境添加用例。完成的定义是:当存在 AWS_CONTAINER_CREDENTIALS_* 或 AWS_EXECUTION_ENV 时,仅设置 Region 也能使 IsConfigured() 返回 true,显式密钥仍然有效,且现有配置测试全部通过。

由索引模型根据 Issue 内容生成。

描述

enhancement

Feature Request: Add support for AWS IAM roles (ECS Task Role / EC2 Instance Profile) for SQS authentication

Description

Currently, Outpost requires explicit AWS credentials (AWS_SQS_ACCESS_KEY_ID and AWS_SQS_SECRET_ACCESS_KEY) for SQS authentication. This prevents the use of AWS IAM roles, which is the recommended security practice for applications running on AWS infrastructure like ECS, EC2, or Lambda.

Current Behavior

When running Outpost on ECS Fargate without explicit credentials, the service fails with:

config validation error: message queue configuration is required

Looking at the source code in internal/config/mqconfig_aws.go, the IsConfigured() method requires non-empty credentials:

func (c *AWSSQSConfig) IsConfigured() bool {
    return c.AccessKeyID != "" && c.SecretAccessKey != "" && c.Region != ""
}

Expected Behavior

Outpost should support AWS IAM roles by:

  1. Detecting when running in an AWS environment with IAM roles available
  2. Using the AWS SDK's default credential provider chain
  3. Only requiring the region when IAM roles are available

Use Case

Many organizations follow AWS security best practices by:

  • Using IAM roles instead of long-lived access keys
  • Running containerized workloads on ECS with task roles
  • Deploying on EC2 instances with instance profiles
  • Following the principle of least privilege

Currently, we have to create IAM users with access keys specifically for Outpost, which:

  • Goes against security best practices
  • Requires additional secret management
  • Increases the attack surface
  • Makes credential rotation more complex

Proposed Solution

Modify the IsConfigured() method to support IAM roles:

func (c *AWSSQSConfig) IsConfigured() bool {
    // Check if running with IAM role credentials
    if hasIAMRoleCredentials() {
        return c.Region != ""
    }
    // Fall back to explicit credentials
    return c.AccessKeyID != "" && c.SecretAccessKey != "" && c.Region != ""
}

func hasIAMRoleCredentials() bool {
    // ECS Task Role
    if os.Getenv("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") != "" {
        return true
    }
    // EC2 Instance Profile
    if os.Getenv("AWS_CONTAINER_CREDENTIALS_FULL_URI") != "" {
        return true
    }
    // Lambda or other AWS services
    if os.Getenv("AWS_EXECUTION_ENV") != "" {
        return true
    }
    return false
}

The AWS SDK for Go already handles credential resolution automatically through its default credential provider chain, so the SQS client initialization should work without explicit credentials when IAM roles are available.

Environment

  • Outpost version: v0.4.1
  • Deployment platform: AWS ECS Fargate
  • AWS SDK: Already included in Outpost

Additional Context

This feature would align Outpost with AWS best practices and make it easier to deploy in production environments. Many similar tools (e.g., Fluent Bit, Prometheus, etc.) support IAM roles out of the box.

Workarounds

Current workarounds include:

  1. Creating IAM users with access keys (security anti-pattern)
  2. Using a sidecar container to provide credentials
  3. Forking Outpost to add IAM role support

None of these are ideal for production use.

References

主要语言
Go
星标
1.1k
派生
70
平均合并
1 天 19 小时
30 天内合并 PR
54

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hookdeck/outpost 的其他 Issue

查看 hookdeck/outpost 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。