Create an S3 bucket
Create an S3 bucket and give Pods access to it.
On this page
- Prerequisites
- 1. Create the bucket
- Optional settings
- 2. Give a Pod access to the bucket
- With IRSA
- With the access key
- 3. Verify
- The bucket is ready
- Credentials are stored
- The Pod can use the bucket with IRSA
- The Pod can use the bucket with the access key
- Troubleshooting
- EnvironmentConfig
- Infralib Configuration Example
This guide creates an Amazon S3 bucket from Kubernetes and gives a Pod access to it.
You describe the bucket with one manifest: S3Bucket. The platform creates the bucket, an IAM user with an access key, an IAM role and policy, and a Kubernetes ServiceAccount set up for IRSA. The access key and bucket details are stored in a Kubernetes Secret and in AWS Secrets Manager. Applications can reach the bucket either through the ServiceAccount (IRSA) or with the access key.
It is good practice to include the manifest in your application’s Helm chart, so the bucket is deployed together with the application that uses it.
Prerequisites
Section titled “Prerequisites”S3Bucket is enabled by default. Your Infralib configuration needs:
| Module | Flag | Default | What it does |
|---|---|---|---|
platform-apis |
platform-apis.s3bucket.install |
true |
Installs the S3Bucket API. |
crossplane-aws |
global.createObservers, global.createNamespacedObservers |
false |
Installs the Secrets Manager provider that stores the credentials. The S3 and IAM providers are always installed. Set both to true. |
aws/kms |
— | — | Optional. If the module exists, its data and config KMS keys are used; otherwise AWS-managed keys are used. |
For the base modules every platform API needs, see Infralib Requirements.
1. Create the bucket
Section titled “1. Create the bucket”A minimal S3Bucket needs no settings at all:
apiVersion: storage.entigo.com/v1alpha1kind: S3Bucketmetadata: name: example-bucketspec: {}This creates an IAM user and a Kubernetes ServiceAccount, both named example-bucket.
kubectl get s3bucket example-bucket -wOptional settings
Section titled “Optional settings”| Field | Default | What it does |
|---|---|---|
enableVersioning |
false |
Turns on versioning for the bucket. |
serviceAccountName |
metadata.name |
Name of the Kubernetes ServiceAccount used for IRSA. |
createServiceAccount |
true |
Creates the ServiceAccount. Set to false to grant access to a ServiceAccount you already have. |
For example, to grant access to an existing ServiceAccount example-app-sa instead of creating one:
apiVersion: storage.entigo.com/v1alpha1kind: S3Bucketmetadata: name: example-bucketspec: createServiceAccount: false serviceAccountName: example-app-sa---# This ServiceAccount must already exist and is not created by the S3Bucket.apiVersion: v1kind: ServiceAccountmetadata: annotations: eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/example-bucket # This annotation must be added manually. name: example-app-saThe ServiceAccount must be in the same namespace as the S3Bucket, and you must add the annotation eks.amazonaws.com/role-arn: arn:aws:iam::<aws-account-number>:role/<metadata.name> yourself.
For every field, see the S3Bucket API reference.
2. Give a Pod access to the bucket
Section titled “2. Give a Pod access to the bucket”With IRSA
Section titled “With IRSA”Run the Pod under the bucket’s ServiceAccount. No credentials are mounted:
apiVersion: v1kind: Podmetadata: name: aws-clispec: serviceAccountName: example-bucket containers: - name: aws-cli image: amazon/aws-cli:latest command: ['sleep', 'infinity']With the access key
Section titled “With the access key”The IAM access key and bucket details are stored in the Kubernetes Secret and the AWS Secrets Manager secret <metadata.name>-credentials. The Secret has the keys AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, BUCKET_NAME, BUCKET_ARN, BUCKET_REGION and credentials.json, which holds all of them as one JSON document.
Load every key as an environment variable:
apiVersion: v1kind: Podmetadata: name: aws-clispec: containers: - name: aws-cli image: amazon/aws-cli:latest command: ['sleep', 'infinity'] envFrom: - secretRef: name: example-bucket-credentialsTo pick individual keys, use env with valueFrom.secretKeyRef instead, for example name: example-bucket-credentials and key: BUCKET_NAME.
Or mount credentials.json as a file:
apiVersion: v1kind: Podmetadata: name: aws-clispec: containers: - name: aws-cli image: amazon/aws-cli:latest command: ['sleep', 'infinity'] volumeMounts: - name: credentials mountPath: /etc/credentials readOnly: true volumes: - name: credentials secret: secretName: example-bucket-credentials items: - key: credentials.json path: credentials.jsonFor more information about Secrets in Kubernetes, see Kubernetes documentation.
3. Verify
Section titled “3. Verify”The bucket is ready
Section titled “The bucket is ready”The S3Bucket shows SYNCED and READY as True:
$ kubectl get s3bucketNAME SYNCED READY COMPOSITION AGEexample-bucket True True s3buckets.storage.entigo.com 1h27mThe bucket appears in the AWS Console:

Credentials are stored
Section titled “Credentials are stored”$ kubectl get secretNAME TYPE DATA AGEexample-bucket-credentials Opaque 6 1h20m
$ kubectl get secret example-bucket-credentials -o yamlapiVersion: v1kind: Secretmetadata: annotations: crossplane.io/composition-resource-name: credentials labels: crossplane.io/composite: example-bucket name: example-bucket-credentials namespace: <namespace>type: Opaquedata: AWS_ACCESS_KEY_ID: <base64-encoded-access-key> AWS_SECRET_ACCESS_KEY: <base64-encoded-secret-access-key> BUCKET_ARN: <base64-encoded-bucket-arn> BUCKET_NAME: <base64-encoded-bucket-name> BUCKET_REGION: <base64-encoded-bucket-region> credentials.json: <base64-encoded-credentials>The same credentials are in AWS Secrets Manager:

The Pod can use the bucket with IRSA
Section titled “The Pod can use the bucket with IRSA”$ kubectl get podNAME READY STATUS RESTARTS AGEaws-cli 1/1 Running 0 3s
$ kubectl exec -it aws-cli -- sh/ touch file.txt
/ aws s3 cp file.txt s3://example-bucket/upload: ./file.txt to s3://example-bucket/file.txt
/ aws s3 ls s3://example-bucket/2025-12-03 08:42:06 0 file.txt
/ aws s3 cp s3://example-bucket/file.txt downloaded-file.txtdownload: s3://example-bucket/file.txt to ./downloaded-file.txtThe Pod can use the bucket with the access key
Section titled “The Pod can use the bucket with the access key”With the environment variables:
$ kubectl exec -it aws-cli -- sh/ envAWS_ACCESS_KEY_ID=AKIAXXXXXXXXXXXXXXXAWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBUCKET_ARN=arn:aws:s3:::example-bucketBUCKET_NAME=example-bucketBUCKET_REGION=eu-north-1
/ aws s3 cp file.txt s3://example-bucket/upload: ./file.txt to s3://example-bucket/file.txt
/ aws s3 ls s3://example-bucket/2025-12-03 08:42:06 0 file.txt
/ aws s3 cp s3://example-bucket/file.txt downloaded-file.txtdownload: s3://example-bucket/file.txt to ./downloaded-file.txtWith the mounted file:
$ cat /etc/credentials/credentials.json{"AWS_ACCESS_KEY_ID": "AKIAXXXXXXXXXXXXXXX", "AWS_SECRET_ACCESS_KEY": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "BUCKET_REGION": "eu-north-1", "BUCKET_ARN": "arn:aws:s3:::example-bucket", "BUCKET_NAME": "example-bucket"}Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause / fix |
|---|---|
no matches for kind "S3Bucket" |
The API is not installed. Check the Prerequisites. |
SYNCED is False |
The platform could not create a cloud resource. kubectl describe s3bucket <name> shows the error under Conditions and Events. |
| The credentials are not in AWS Secrets Manager | createObservers and createNamespacedObservers are off on crossplane-aws, so the Secrets Manager provider is not installed. See Prerequisites. |
| The Pod gets access denied with an existing ServiceAccount | With createServiceAccount: false the ServiceAccount must be in the same namespace as the S3Bucket and carry the eks.amazonaws.com/role-arn annotation. |
EnvironmentConfig
Section titled “EnvironmentConfig”There are no S3-specific defaults for developers to worry about. The one cluster-wide setting that affects buckets is tagging.
| Setting | Default | What it does |
|---|---|---|
tags |
{} |
Cloud tags added to every bucket and its IAM resources. See Resource Tagging. |
Infralib Configuration Example
Section titled “Infralib Configuration Example”steps: ... - name: apps type: argocd-apps modules: ... - name: crossplane-aws source: crossplane-aws inputs: global: createObservers: true createNamespacedObservers: true ... - name: platform-apis source: platform-apis inputs: platform-apis: storage: environmentConfig: tags: cost-center: CC-12345