Product Docs
-
- Overview
- FAQs
- Verifying Images
- How to Use
- Going Distroless
-
-
-
-
-
- Minimal Runtime Images
- Using the Static Base Image
- Software Versions
- Chainguard Security Advisories & Diff API
- Image Digests
- Up-to-date Images with Digestabot
- Migrating Go Applications to Chainguard
- Reproducible Dockerfiles with Frizbee and Digestabot
- Why our images have Low-to-No CVEs
- Reproducibility and Chainguard Images
- Debugging Distroless Containers
- Debugging with Kubectl and CDebug
- Migrate Node.js Applications to Chainguard
- Migrate Java Applications to Chainguard
-
- gpu-operator-validator
- contour
- contour-bitnami
- authservice
- authservice-fips
- cfssl-self-sign
- local-path-provisioner
- neuvector-controller-fips
- neuvector-enforcer-fips
- neuvector-updater-fips
- openresty
- prometheus-blackbox-exporter-fips
- sonar-scanner-cli
- tomcat-fips
- teleport
- kubernetes-dashboard-metrics-scraper-fips
- calico-apiserver-fips
- neuvector-controller
- neuvector-enforcer
- neuvector-manager
- neuvector-updater
- nvidia-gpu-driver
- tomcat-jdk8
- aws-for-fluent-bit-fips
- redis-cluster-bitnami-fips
- redis-sentinel-bitnami-fips
- redis-server-bitnami-fips
- spdx-tools
- redis-bitnami-fips-cluster-bitnami
- redis-bitnami-fips-sentinel-bitnami
- redis-bitnami-fips-server-bitnami
- fluent-operator-fips
- zookeeper-fips
- openscap
- rabbitmq-bitnami-fips
- calico-apiserver
- airflow
- flink
- kibana
- rabbitmq-default-user-credential-updater
- jitsucom-console
- jitsucom-rotor
- tempo-fips
- fluent-bit-plugin-loki
- grafana-rollout-operator
- octo-sts
- mlflow-bitnami
- go-openssl
- jitsucom-bulker
- jitsucom-bulker-bulker
- jitsucom-bulker-ingest
- jitsucom-bulker-syncctl
- jitsucom-ingest
- jitsucom-syncctl
- mlflow
- rabbitmq-bitnami
- eck-operator
- elasticsearch-fips
- superset
- argocd-repo-server-fips
- argocd-server-fips
- grafana-operator-bitnami-fips
- harbor-core-fips
- harbor-db-fips
- harbor-jobservice-fips
- harbor-portal-fips
- harbor-registry-fips
- harbor-registryctl-fips
- harbor-trivy-adapter-fips
- kube-vip-fips
- opentelemetry-collector-fips
- kube-vip
- opentelemetry-collector
- harbor-fips-db
- step-ca-fips
- step-cli-fips
- wave-fips
- wave
- local-volume-node-cleanup
- datadog-cluster-agent
- karpenter-fips
- local-volume-provisioner
- gha-runner-scale-set-controller
- gha-runner-scale-set-controller-fips
- kube-rbac-proxy
- valkey
- grafana-operator
- grafana-operator-fips
- kubeflow-katib-suggestion-nas-darts
- litestream
- step-issuer
- step-issuer-fips
- vertical-pod-autoscaler-fips-admission-controller
- vertical-pod-autoscaler-fips-recommender
- vertical-pod-autoscaler-fips-updater
- prometheus-pushgateway-bitnami-bitnami
- redis-bitnami-cluster-bitnami
- redis-bitnami-sentinel-bitnami
- redis-bitnami-server-bitnami
- tesseract-fips
- kubernetes-autoscaler-addon-resizer
- kubernetes-autoscaler-addon-resizer-fips
- node-feature-discovery
- laravel
- argocd-extension-installer-fips
- cortex-fips
- hubble-ui-backend
- step-ca
- step-cli
- kyverno-fips-background-controller
- kyverno-fips-cleanup-controller
- kyverno-fips-cli
- kyverno-fips-reports-controller
- kyverno-fipspre
- aws-volume-modifier-for-k8s-fips
- azure-aad-pod-identity-mic
- azure-aad-pod-identity-nmi
- chainguard-base
- chainguard-base-fips
- configurable-http-proxy-fips
- dex-k8s-authenticator
- eks-distro-coredns
- eks-distro-kubernetes-csi-external-attacher
- eks-distro-kubernetes-csi-external-provisioner
- eks-distro-kubernetes-csi-external-resizer
- eks-distro-kubernetes-csi-external-snapshot-controller
- eks-distro-kubernetes-csi-external-snapshot-validation-webhook
- eks-distro-kubernetes-csi-external-snapshotter
- eks-distro-kubernetes-csi-livenessprobe
- eks-distro-kubernetes-csi-node-driver-registrar
- elasticsearch
- glibc-openssl
- glibc-openssl-fips
- gpu-operator
- grafana-operator-fips-bitnami
- hubble-ui
- hubble-ui-backend-fips
- hubble-ui-fips
- jdk-fips
- jre-fips
- jupyterhub-k8s-hub-fips
- k8ssandra-system-logger-fips
- keycloak-fips
- kiam
- kots
- kube-oidc-proxy
- kube-rbac-proxy-fips
- kubeflow-pipelines
- kubernetes-csi-external-snapshotter-snaphot-validation-webhook
- kubernetes-dashboard-metrics-scraper
- kubernetes-event-exporter-bitnami
- kyvernopre
- memcached-bitnami
- mongodb-bitnami
- mysql
- postgres-bitnami
- postgres-bitnami-fips
- prometheus-beat-exporter-fips
- prometheus-bitnami
- prometheus-elasticsearch-exporter-bitnami
- prometheus-mongodb-exporter-bitnami
- prometheus-node-exporter-bitnami
- prometheus-postgres-exporter-bitnami
- prometheus-pushgateway-exporter
- prometheus-pushgateway-exporter-bitnami
- prometheus-pushgateway-fips
- pulumi-kubernetes-operator
- python-fips
- rabbitmq-fips
- renovate
- spark-bitnami
- vault-k8s-fips
- wavefront-collector-for-kubernetes
- zookeeper-bitnami
- apache-nifi
- apko
- argo-cli
- argo-cli-fips
- argo-exec
- argo-exec-fips
- argo-workflowcontroller
- argo-workflowcontroller-fips
- argocd
- argocd-extension-installer
- argocd-fips
- argocd-fips-repo-server
- argocd-repo-server
- aspnet-runtime
- aspnet-runtime-fips
- atlantis
- atlantis-fips
- aws-cli
- aws-cli-fips
- aws-cli-v2
- aws-cli-v2-fips
- aws-ebs-csi-driver
- aws-ebs-csi-driver-fips
- aws-efs-csi-driver
- aws-for-fluent-bit
- aws-load-balancer-controller
- aws-load-balancer-controller-fips
- az
- az-fips
- bank-vaults
- bank-vaults-fips
- bash
- bazel
- bincapz
- boring-registry
- boring-registry-fips
- buck2
- buildkit
- bun
- busybox
- busybox-fips
- caddy
- caddy-fips
- cadvisor
- cadvisor-fips
- calico
- calico-calicoctl
- calico-calicoctl-fips
- calico-cni
- calico-cni-fips
- calico-csi
- calico-csi-fips
- calico-key-cert-provisioner
- calico-kube-controllers
- calico-kube-controllers-fips
- calico-node
- calico-node-driver-registrar
- calico-node-driver-registrar-fips
- calico-node-fips
- calico-pod2daemon
- calico-pod2daemon-flexvol
- calico-pod2daemon-flexvol-fips
- calico-typha
- calico-typha-fips
- calicoctl
- cass-config-builder
- cass-operator
- cass-operator-fips
- cassandra
- cassandra-medusa
- cassandra-medusa-fips
- cassandra-reaper
- cc-dynamic
- cedar
- cert-exporter
- cert-exporter-fips
- cert-manager-acmesolver
- cert-manager-acmesolver-fips
- cert-manager-cainjector
- cert-manager-cainjector-fips
- cert-manager-cmctl
- cert-manager-cmctl-fips
- cert-manager-controller
- cert-manager-controller-fips
- cert-manager-webhook
- cert-manager-webhook-fips
- cert-manager-webhook-pdns
- cert-manager-webhook-pdns-fips
- cfssl
- chromium
- cilium-agent
- cilium-agent-fips
- cilium-hubble-relay
- cilium-hubble-relay-fips
- cilium-hubble-ui
- cilium-hubble-ui-backend
- cilium-hubble-ui-backend-fips
- cilium-hubble-ui-fips
- cilium-operator-generic
- cilium-operator-generic-fips
- clang
- clickhouse
- cluster-autoscaler
- cluster-autoscaler-fips
- cluster-proportional-autoscaler
- conda
- conda-fips
- configmap-reload
- configmap-reload-fips
- confluent-kafka
- consul
- consul-fips
- coredns
- coredns-fips
- cortex
- cosign
- cosign-fips
- crane
- crossplane
- crossplane-aws
- crossplane-aws-cloudfront
- crossplane-aws-cloudwatchlogs
- crossplane-aws-dynamodb
- crossplane-aws-ec2
- crossplane-aws-eks
- crossplane-aws-firehose
- crossplane-aws-iam
- crossplane-aws-kms
- crossplane-aws-lambda
- crossplane-aws-rds
- crossplane-aws-s3
- crossplane-aws-sns
- crossplane-aws-sqs
- crossplane-azure
- crossplane-azure-authorization
- crossplane-azure-managedidentity
- crossplane-azure-sql
- crossplane-azure-storage
- crossplane-xfn
- ctlog-trillian-ctserver
- ctlog-trillian-ctserver-fips
- curl
- dask-gateway
- dask-gateway-dask-gateway
- dask-gateway-dask-gateway-server
- dask-gateway-server
- datadog-agent
- datadog-agent-fips
- deno
- dependency-track
- dex
- dex-fips
- dive
- docker-cli
- docker-selenium
- doppler-kubernetes-operator
- dotnet-runtime
- dotnet-runtime-fips
- dotnet-sdk
- dotnet-sdk-fips
- dragonfly
- dynamic-localpv-provisioner
- envoy
- envoy-fips
- envoy-ratelimit
- envoy-ratelimit-fips
- erlang
- erlang-fips
- etcd
- etcd-fips
- external-dns
- external-dns-fips
- external-secrets
- external-secrets-fips
- falco-no-driver
- falco-no-driver-fips
- falcoctl
- falcoctl-fips
- falcosidekick
- falcosidekick-fips
- ffmpeg
- filebeat
- filebeat-fips
- fluent-bit
- fluent-bit-fips
- fluent-operator
- fluentd
- fluentd-fips
- flux
- flux-helm-controller
- flux-image-automation-controller
- flux-image-reflector-controller
- flux-kustomize-controller
- flux-notification-controller
- flux-source-controller
- fulcio
- fulcio-fips
- gatekeeper
- gatekeeper-fips
- gcc-glibc
- git
- gitlab-exporter
- gitlab-kas
- gitlab-pages
- gitlab-shell
- gitness
- glibc-dynamic
- go
- go-fips
- go-ipfs
- go-ipfs-fips
- google-cloud-sdk
- gotenberg
- gptscript
- gpu-feature-discovery
- graalvm-native
- gradle
- grafana
- grafana-agent-operator
- grafana-fips
- grafana-mimir
- grype
- guacamole-server
- haproxy
- haproxy-fips
- haproxy-ingress
- harbor-core
- harbor-db
- harbor-fips-core
- harbor-fips-jobservice
- harbor-fips-portal
- harbor-fips-registry
- harbor-fips-registryctl
- harbor-fips-trivy-adapter
- harbor-jobservice
- harbor-portal
- harbor-registry
- harbor-registryctl
- harbor-trivy-adapter
- helm
- helm-chartmuseum
- helm-fips
- helm-operator
- helm-operator-fips
- http-echo
- hugo
- influxdb
- ingress-nginx-controller
- ingress-nginx-controller-fips
- ip-masq-agent
- istio-install-cni
- istio-install-cni-fips
- istio-operator
- istio-operator-fips
- istio-pilot
- istio-pilot-fips
- istio-proxy
- istio-proxy-fips
- jdk
- jdk-lts
- jellyfin
- jenkins
- jre
- jre-lts
- k3s
- k3s-allinone
- k8s-sidecar
- k8s-sidecar-fips
- k8sgpt
- k8sgpt-operator
- k8ssandra-operator
- k8ssandra-operator-fips
- kafka
- karpenter
- keda
- keda-adapter
- keda-adapter-fips
- keda-admission-webhooks
- keda-admission-webhooks-fips
- keda-fips
- keycloak
- keycloak-operator
- ko
- kor
- kube-bench
- kube-bench-fips
- kube-downscaler
- kube-fluentd-operator
- kube-logging-operator
- kube-logging-operator-fluentd
- kube-state-metrics
- kube-state-metrics-fips
- kube-webhook-certgen
- kube-webhook-certgen-fips
- kubectl
- kubectl-fips
- kubeflow-centraldashboard
- kubeflow-jupyter-web-app
- kubeflow-katib-controller
- kubeflow-katib-db-manager
- kubeflow-katib-earlystopping-medianstop
- kubeflow-katib-file-metrics-collector
- kubeflow-katib-suggestion-darts
- kubeflow-katib-suggestion-goptuna
- kubeflow-katib-suggestion-hyperband
- kubeflow-katib-suggestion-hyperopt
- kubeflow-katib-suggestion-optuna
- kubeflow-katib-suggestion-pbt
- kubeflow-katib-suggestion-skopt
- kubeflow-pipelines-api-server
- kubeflow-pipelines-cache-deployer
- kubeflow-pipelines-cache-server
- kubeflow-pipelines-frontend
- kubeflow-pipelines-metadata-envoy
- kubeflow-pipelines-metadata-writer
- kubeflow-pipelines-persistenceagent
- kubeflow-pipelines-scheduledworkflow
- kubeflow-pipelines-viewer-crd-controller
- kubeflow-pipelines-visualization-server
- kubeflow-volumes-web-app
- kuberay-operator
- kubernetes-csi-external-attacher
- kubernetes-csi-external-attacher-fips
- kubernetes-csi-external-provisioner
- kubernetes-csi-external-resizer
- kubernetes-csi-external-resizer-fips
- kubernetes-csi-external-snapshot-controller
- kubernetes-csi-external-snapshot-validation-webhook
- kubernetes-csi-external-snapshotter
- kubernetes-csi-livenessprobe
- kubernetes-csi-livenessprobe-fips
- kubernetes-csi-node-driver-registrar
- kubernetes-csi-node-driver-registrar-fips
- kubernetes-dashboard
- kubernetes-dashboard-fips
- kubernetes-dns-node-cache
- kubernetes-event-exporter
- kubernetes-ingress-defaultbackend
- kubewatch
- kyverno
- kyverno-background-controller
- kyverno-background-controller-fips
- kyverno-cleanup-controller
- kyverno-cleanup-controller-fips
- kyverno-cli
- kyverno-cli-fips
- kyverno-fips
- kyverno-policy-reporter
- kyverno-policy-reporter-plugin
- kyverno-policy-reporter-reporter
- kyverno-policy-reporter-ui
- kyverno-pre-fips
- kyverno-reports-controller
- kyverno-reports-controller-fips
- logstash-oss-with-opensearch-output-plugin
- loki
- management-api-for-apache-cassandra
- mariadb
- maven
- mdbook
- meilisearch
- melange
- memcached
- memcached-exporter
- memcached-exporter-bitnami
- metacontroller
- metallb-controller
- metallb-controller-fips
- metallb-speaker
- metallb-speaker-fips
- metrics-server
- metrics-server-fips
- min-toolkit-debug
- minio
- minio-client
- minio-client-fips
- minio-fips
- ml-metadata-store-server
- mongodb
- mongodb-fips
- multus-cni
- multus-cni-fips
- nats
- nemo
- netcat
- neuvector-prometheus-exporter
- neuvector-prometheus-exporter-fips
- neuvector-scanner
- neuvector-scanner-fips
- newrelic-fluent-bit-output
- newrelic-infrastructure-bundle
- newrelic-infrastructure-k8s
- newrelic-k8s-events-forwarder
- newrelic-kube-events
- newrelic-kubernetes
- newrelic-nri-statsd
- newrelic-prometheus
- newrelic-prometheus-configurator
- nfs-subdir-external-provisioner
- nfs-subdir-external-provisioner-fips
- nginx
- nginx-fips
- node
- node-fips
- node-lts
- node-problem-detector
- nodetaint
- ntia-conformance-checker
- ntpd-rs
- nvidia-container-toolkit
- nvidia-device-plugin
- oauth2-proxy
- openai
- opensearch
- opensearch-dashboards
- opensearch-dashboards-fips
- opentelemetry-collector-contrib
- opentelemetry-collector-contrib-fips
- opentf
- opentofu
- paranoia
- percona-server
- pgbouncer
- pgbouncer-fips
- php
- php-fpm_exporter
- postgres
- postgres-fips
- postgres-helm-compat
- postgres-operator
- postgres-operator-fips
- powershell
- prometheus
- prometheus-adapter
- prometheus-adapter-fips
- prometheus-alertmanager
- prometheus-alertmanager-fips
- prometheus-blackbox-exporter
- prometheus-cloudwatch-exporter
- prometheus-config-reloader
- prometheus-config-reloader-fips
- prometheus-elasticsearch-exporter
- prometheus-elasticsearch-exporter-fips
- prometheus-fips
- prometheus-logstash-exporter
- prometheus-logstash-exporter-fips
- prometheus-mongodb-exporter
- prometheus-mongodb-exporter-fips
- prometheus-mysqld-exporter
- prometheus-node-exporter
- prometheus-node-exporter-fips
- prometheus-operator
- prometheus-operator-fips
- prometheus-postgres-exporter
- prometheus-postgres-exporter-fips
- prometheus-pushgateway
- prometheus-pushgateway-bitnami
- prometheus-redis-exporter
- prometheus-redis-exporter-fips
- prometheus-statsd-exporter
- prometheus-statsd-exporter-fips
- promtail
- proxysql
- pulumi
- python
- pytorch-cuda12
- qdrant
- r-base
- rabbitmq
- rabbitmq-cluster-operator
- rabbitmq-messaging-topology-operator
- redis
- redis-cluster-bitnami
- redis-fips
- redis-sentinel
- redis-sentinel-bitnami
- redis-server-bitnami
- rekor-backfill-redis
- rekor-backfill-redis-fips
- rekor-cli
- rekor-cli-fips
- rekor-server
- rekor-server-fips
- rqlite
- rstudio
- rstudio-fips
- ruby
- rust
- secrets-store-csi-driver
- secrets-store-csi-driver-provider-gcp
- semgrep
- shadowsocks-rust-sslocal
- shadowsocks-rust-ssserver
- sigstore-policy-controller
- sigstore-policy-controller-fips
- sigstore-scaffolding-cloudsqlproxy
- sigstore-scaffolding-cloudsqlproxy-fips
- sigstore-scaffolding-ctlog-createctconfig
- sigstore-scaffolding-ctlog-createctconfig-fips
- sigstore-scaffolding-ctlog-managectroots
- sigstore-scaffolding-ctlog-managectroots-fips
- sigstore-scaffolding-ctlog-verifyfulcio
- sigstore-scaffolding-ctlog-verifyfulcio-fips
- sigstore-scaffolding-fulcio-createcerts
- sigstore-scaffolding-fulcio-createcerts-fips
- sigstore-scaffolding-getoidctoken
- sigstore-scaffolding-getoidctoken-fips
- sigstore-scaffolding-rekor-createsecret
- sigstore-scaffolding-rekor-createsecret-fips
- sigstore-scaffolding-trillian-createdb
- sigstore-scaffolding-trillian-createdb-fips
- sigstore-scaffolding-trillian-createtree
- sigstore-scaffolding-trillian-createtree-fips
- sigstore-scaffolding-trillian-updatetree
- sigstore-scaffolding-trillian-updatetree-fips
- sigstore-scaffolding-tsa-createcertchain
- sigstore-scaffolding-tsa-createcertchain-fips
- sigstore-scaffolding-tuf-createsecret
- sigstore-scaffolding-tuf-createsecret-fips
- sigstore-scaffolding-tuf-server
- sigstore-scaffolding-tuf-server-fips
- skaffold
- slim-toolkit-debug
- smarter-device-manager
- smarter-device-manager-fips
- solr
- spark-operator
- spire-agent
- spire-agent-fips
- spire-oidc-discovery-provider
- spire-oidc-discovery-provider-fips
- spire-server
- spire-server-fips
- sqlpad
- sqlpad-fips
- squid-proxy
- squid-proxy-fips
- stakater-reloader
- static
- statsd
- stunnel
- tekton-chains
- tekton-chains-fips
- tekton-cli
- tekton-cli-fips
- tekton-controller
- tekton-controller-fips
- tekton-entrypoint
- tekton-entrypoint-fips
- tekton-events
- tekton-events-fips
- tekton-nop
- tekton-nop-fips
- tekton-resolvers
- tekton-resolvers-fips
- tekton-sidecarlogresults
- tekton-sidecarlogresults-fips
- tekton-webhook
- tekton-webhook-fips
- tekton-workingdirinit
- tekton-workingdirinit-fips
- telegraf
- tempo
- temporal-admin-tools
- temporal-admin-tools-fips
- temporal-server
- temporal-server-fips
- temporal-ui-server
- temporal-ui-server-fips
- terraform
- tesseract
- thanos
- thanos-fips
- thanos-operator
- thanos-operator-fips
- tigera-operator
- tigera-operator-fips
- timestamp-authority-cli
- timestamp-authority-server
- timoni
- tomcat
- traefik
- traefik-fips
- trillian-logserver
- trillian-logserver-fips
- trillian-logsigner
- trillian-logsigner-fips
- trino
- trust-manager
- trust-manager-fips
- vault
- vault-fips
- vault-k8s
- vector
- vela-cli
- velero
- velero-fips
- velero-plugin-for-aws
- velero-plugin-for-aws-fips
- velero-plugin-for-csi
- velero-plugin-for-csi-fips
- velero-restore-helper
- velero-restore-helper-fips
- vertical-pod-autoscaler-admission-controller
- vertical-pod-autoscaler-recommender
- vertical-pod-autoscaler-updater
- vt
- wait-for-it
- wasmer
- wasmtime
- wavefront-proxy
- wazero
- weaviate
- wolfi-base
- yara
- zig
- zookeeper
- zot
- How Images are Tested
- Product Release Lifecycle
- Debugging
-
-
-
-
- chainctl
- chainctl auth
- chainctl auth configure-docker
- chainctl auth login
- chainctl auth logout
- chainctl auth status
- chainctl auth token
- chainctl config
- chainctl config edit
- chainctl config reset
- chainctl config save
- chainctl config set
- chainctl config unset
- chainctl config validate
- chainctl config view
- chainctl events
- chainctl events subscriptions
- chainctl events subscriptions create
- chainctl events subscriptions delete
- chainctl events subscriptions list
- chainctl iam
- chainctl iam account-associations
- chainctl iam account-associations check
- chainctl iam account-associations check aws
- chainctl iam account-associations check gcp
- chainctl iam account-associations describe
- chainctl iam account-associations set
- chainctl iam account-associations set aws
- chainctl iam account-associations set gcp
- chainctl iam account-associations unset
- chainctl iam account-associations unset aws
- chainctl iam account-associations unset gcp
- chainctl iam folders
- chainctl iam folders delete
- chainctl iam folders describe
- chainctl iam folders list
- chainctl iam folders update
- chainctl iam identities
- chainctl iam identities create
- chainctl iam identities create github
- chainctl iam identities create gitlab
- chainctl iam identities delete
- chainctl iam identities describe
- chainctl iam identities list
- chainctl iam identities update
- chainctl iam identity-providers
- chainctl iam identity-providers create
- chainctl iam identity-providers delete
- chainctl iam identity-providers list
- chainctl iam identity-providers update
- chainctl iam invites
- chainctl iam invites create
- chainctl iam invites delete
- chainctl iam invites list
- chainctl iam organizations
- chainctl iam organizations delete
- chainctl iam organizations describe
- chainctl iam organizations list
- chainctl iam role-bindings
- chainctl iam role-bindings create
- chainctl iam role-bindings delete
- chainctl iam role-bindings list
- chainctl iam role-bindings update
- chainctl iam roles
- chainctl iam roles capabilities
- chainctl iam roles capabilities list
- chainctl iam roles create
- chainctl iam roles delete
- chainctl iam roles list
- chainctl iam roles update
- chainctl images
- chainctl images diff
- chainctl images list
- chainctl images repos
- chainctl images repos list
- chainctl update
- chainctl version
Open Source
Education
Create an Assumable Identity for an AWS role
Chainguard’s assumable identities are identities that can be assumed by external applications or workflows in order to perform certain tasks that would otherwise have to be done by a human.
This procedural tutorial outlines how to create an identity using Terraform, and then create an AWS role that will assume the identity to interact with Chainguard resources. This can be used to authorize requests from AWS Lambda, ECS, EKS, or any other AWS service that supports IAM roles for service accounts.
Prerequisites
To complete this guide, you will need the following.
terraform
installed on your local machine. Terraform is an open-source Infrastructure as Code tool which this guide will use to create various cloud resources. Follow the official Terraform documentation for instructions on installing the tool.chainctl
— the Chainguard command line interface tool — installed on your local machine. Follow our guide on How to Installchainctl
to set this up.- An AWS account with the AWS CLI installed and configured. The Terraform provider for AWS uses credentials configured via the AWS CLI.
- A recent version of Go to test the identity with AWS Lambda.
Creating Terraform Files
We will be using Terraform to create an identity for an AWS role to assume. This step outlines how to create the Terraform configuration files that, together, will produce such an identity.
These files are available in Chainguard’s GitHub Repository of Platform Examples.
To help explain each configuration file’s purpose, we will go over what they do one by one. First, though, create a directory to hold the Terraform configuration and navigate into it.
mkdir ~/aws-id && cd $_
This will help make it easier to clean up your system at the end of this guide.
main.tf
The first file, which we will call main.tf
, will serve as the scaffolding for our Terraform infrastructure.
The file will consist of the following content.
terraform {
required_providers {
aws = { source = "hashicorp/aws" }
chainguard = { source = "chainguard-dev/chainguard" }
ko = { source = "ko-build/ko" }
}
}
This is a fairly barebones Terraform configuration file, but we will define the rest of the resources in the other two files. In main.tf
, we declare and initialize the Chainguard Terraform provider.
Next we’ll create lambda.tf
to define the AWS resources to run the Lambda function, and chainguard.tf
to define the Chainguard resources that the Lambda function will interact with.
lambda.tf
The lambda.tf
describes the AWS role that a Lambda function will run as.
data "aws_iam_policy_document" "lambda" {
statement {
effect = "Allow"
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["lambda.amazonaws.com"]
}
}
}
data "aws_iam_policy" "lambda" {
name = "AWSLambdaBasicExecutionRole"
}
resource "aws_iam_role" "lambda" {
name = "aws-auth"
assume_role_policy = data.aws_iam_policy_document.lambda.json
managed_policy_arns = [data.aws_iam_policy.lambda.arn]
}
This describes an AWS role that a Lambda function will run as. The Lambda function will assume this role, and then use the Chainguard identity to interact with Chainguard resources.
The lambda.tf
file also creates an AWS Lambda function that will assume the identity you created in the previous section. This function will then use the identity to interact with Chainguard resources.
The final section defines a AWS lambda function implemented in Go that will assume the identity you created in the previous section:
resource "aws_lambda_function" "test_lambda" {
filename = "lambda_function_payload.zip"
function_name = "lambda_function_name"
role = aws_iam_role.iam_for_lambda.arn
handler = "bootstrap"
source_code_hash = data.archive_file.lambda.output_base64sha256
runtime = "go1.x"
}
Check out this basic example for configuring AWS Lambda using Terraform, and the docs for deploying Go Lambda functions with .zip file archives for more information on how to configure the filename
and source_code_hash
fields.
Below we’ll go over some of the specific details from the example Go application.
After it’s deployed, when this function is invoked, it will assume the AWS role you created in the previous section. It will then be able to present credentials as that AWS role that will allow it to assume the Chainguard identity you created in the previous section, to view and manage Chainguard resources.
Next, you can create the chainguard.tf
file.
chainguard.tf
chainguard.tf
will create a few resources that will help us test out the identity.
resource "chainguard_group" "example-group" {
name = "example-group"
description = <<EOF
This organization simulates an end-user organization, which the AWS role identity
can interact with via the identity in aws.tf.
EOF
}
This section creates a Chainguard IAM organization named example-group
, as well as a description of the organization. This will serve as some data for the identity to access when we test it out later on.
Then we’ll define a Chainguard identity that can be assumed by the AWS role created in lambda.tf
above:
resource "chainguard_identity" "aws" {
parent_id = data.chainguard_group.example-group.id
name = "aws-auth-identity"
description = "Identity for AWS Lambda"
aws_identity {
aws_account = data.aws_caller_identity.current.account_id
aws_user_id_pattern = "^AROA(.*):${local.lambda_name}$"
// NB: This role will be assumed so can't use the role ARN directly. We must use the ARN of the assumed role
aws_arn = "arn:aws:sts::${data.aws_caller_identity.current.account_id}:assumed-role/${aws_iam_role.lambda.name}/${local.lambda_name}"
}
}
The most important part of this section is the aws_identity
block. When the AWS role tries to assume this identity later on, it must present a token matching the aws_account
, aws_user_id_pattern
, and aws_arn
specified here in order to do so.
The aws_user_id_pattern
field configures the identity to be assumable only by the AWS role with the specified name, which is itself assumed by another execution role, which we’ll configure below. This role will be assumed so can’t use the role ARN directly in aws_arn
; We must used the ARN of the assumed role.
The section after that looks up the viewer
role.
data "chainguard_role" "viewer" {
name = "viewer"
}
The final section grants this role to the identity on the example-group
.
resource "chainguard_rolebinding" "view-stuff" {
identity = chainguard_identity.aws.id
group = data.chainguard_group.example-group.id
role = data.chainguard_role.viewer.items[0].id
}
After defining these resources, there are some other resources in the example directory that build and deploy a Lambda function that assumes the identity. We’ll describe that code in the next section.
After defining these resources, your Terraform configuration will be ready. Now you can run a few terraform
commands to create the resources defined in your .tf
files.
Creating Your Resources
First, run terraform init
to initialize Terraform’s working directory.
terraform init
Then run terraform plan
. This will produce a speculative execution plan that outlines what steps Terraform will take to create the resources defined in the files you set up in the last section.
terraform plan
Then apply the configuration.
terraform apply
Before going through with applying the Terraform configuration, this command will prompt you to confirm that you want it to do so. Enter yes
to apply the configuration.
...
Plan: 8 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ aws-identity = (known after apply)
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value:
After typing yes
and pressing ENTER
, the command will complete and will output an aws-identity
value.
...
Apply complete! Resources: 8 added, 0 changed, 0 destroyed.
Outputs:
aws-identity = "<your identity>"
This is the identity’s UIDP (unique identity path), which you configured the chainguard.tf
file to emit in the previous section. Note this value down, as you’ll need it to set up the AWS role you’ll use to test the identity. If you need to retrieve this UIDP later on, though, you can always run the following chainctl
command to obtain a list of the UIDPs of all your existing identities.
chainctl iam identities ls
Testing the Identity
When the AWS Lambda function is invoked, first it needs to get its credentials, which assert that it is the AWS IAM role defined earlier.
The example code in Go does this with aws-sdk-go-v2
:
// Get AWS credentials.
cfg, err := config.LoadDefaultConfig(ctx)
if err != nil {
return "", fmt.Errorf("failed to load configuration, %w", err)
}
creds, err := cfg.Credentials.Retrieve(ctx)
if err != nil {
return "", fmt.Errorf("failed to retrieve credentials, %w", err)
}
These credentials represent the AWS role assumed by the Lambda function ("aws-auth"
defined above in lambda.tf
).
You can use the Chainguard SDK for Go to generate a token that Chainguard understands, to authenticate the Lambda function as the Chainguard identity you created earlier, by its UIDP:
// Generate a token and exchange it for a Chainguard token.
awsTok, err := aws.GenerateToken(ctx, creds, env.Issuer, env.Identity)
if err != nil {
return "", fmt.Errorf("generating AWS token: %w", err)
}
exch := sts.New(env.Issuer, env.APIEndpoint, sts.WithIdentity(env.Identity))
cgtok, err := exch.Exchange(ctx, awsTok)
if err != nil {
return "", fmt.Errorf("exchanging token: %w", err)
}
The resulting token, cgtok
, can be used to authenticate requests to Chainguard API calls:
// Use the token to list repos in the organization.
clients, err := registry.NewClients(ctx, env.APIEndpoint, cgtok)
if err != nil {
return "", fmt.Errorf("creating clients: %w", err)
}
ls, err := clients.Registry().ListRepos(ctx, ®istry.RepoFilter{
Uidp: &common.UIDPFilter{
ChildrenOf: env.Group,
},
})
Removing Sample Resources
To remove the resources Terraform created, you can run the terraform destroy
command.
terraform destroy
This will destroy the role-binding, and the identity created in this guide. However, you’ll need to destroy the example-group
organization yourself with chainctl
. It will also delete all the AWS resources defined earlier in chainguard.tf
and lambda.tf
.
chainctl iam organizations rm example-group
You can then remove the working directory to clean up your system.
rm -r ~/aws-id/
Following that, all of the example resources created in this guide will be removed from your system.
Learn more
For more information about how assumable identities work in Chainguard, check out our conceptual overview of assumable identities. Additionally, the Terraform documentation includes a section on recommended best practices which you can refer to if you’d like to build on this Terraform configuration for a production environment.
Last updated: 2024-05-09 08:48