Skip to content

Configuration with Environment Variables and Secrets v2

Komalis edited this page Apr 10, 2025 · 2 revisions
metadata:
  appname: "helloworld"
role:
  managed_policies: []
  statements:
    - sid: "ssmactions"
      resources: ["*"]
      actions: ["ssmmessages:CreateControlChannel", "ssmmessages:CreateDataChannel", "ssmmessages:OpenControlChannel", "ssmmessages:OpenDataChannel", "secretsmanager:*"]
      effect: "Allow"
execution_role:
  managed_policies: ["service-role/AmazonECSTaskExecutionRolePolicy", "AmazonEC2ContainerRegistryReadOnly"]
  statements:
    - sid: "secretmanageractions"
      resources: ["*"]
      actions: ["secretsmanager:GetSecretValue"]
      effect: "Allow"
    - sid: "s3actions"
      resources: ["*"]
      actions: ["s3:*"]
      effect: "Allow"
task_definition:
  resources:
    limits:
      cpu: 2
      memory: 4096
  containers:
    - name: helloworld
      image: docker.io/library/debian
      user: root
      tty: true
      command: "/bin/bash"
      resources:
        limits:
          cpu: 1
          memory: 2048
      env:
          METRICS_SAMPLING: "1.0"
          TRACING_SAMPLING: "1.0"
          APP_ACCESS_LOGS_OPT: ""
      secrets:
        - name: APIKEY
          valueFrom: "arn:aws:secretsmanager:eu-west-1:<ACCOUNT_ID>:<SECRET_ID>"
        - name: DATABASE_URI
          valueFrom: "arn:aws:secretsmanager:eu-west-1:<ACCOUNT_ID>:secret:<SECRET_ID>:<SECRET_FIELD>::"

Clone this wiki locally