AWS Builder Center
EKS + S3 Security: Building a Secure Kubernetes Application on AWS

EKS + S3 Security: Building a Secure Kubernetes Application on AWS

Running containerized applications on AWS requires two core pillars: compute management and secure data storage. By pairing Amazon EKS (Elastic Kubernetes Service) with Amazon S3, you can build a scalable application environment while maintaining tight security controls. Here is how EKS and S3 work together, alongside key security best practices to protect your data.

Why Amazon EKS?

Managing a self-hosted Kubernetes cluster means looking after etcd, patching control planes, and maintaining high availability across multiple availability zones.
Amazon EKS automates this by managing the control plane for you. AWS handles the API server and scaling infrastructure, while you focus on running your containerized workloads using:
  • Managed Node Groups: EC2 instances automatically provisioned and patched by AWS.
  • AWS Fargate: Serverless execution for pods without running nodes.
  • EKS Auto Mode: Hands-off compute, networking, and storage management.


2. Securing Application Data in Amazon S3

When your EKS workloads store data in S3, misconfigurations can lead to public exposure. Security requires configuring access at both the identity and resource levels.


Evaluation Order

AWS evaluates requests using a simple rule: Explicit Deny > Explicit Allow > Default Deny.
Feature
IAM Policy
S3 Bucket Policy
Attached To
IAM User, Group, or Role
The S3 Bucket directly
Question Answered
"What can this identity do?"
"Who can touch this bucket?"
Best For
User & workload permissions
Cross-account access & enforcing HTTPS


3. Step-by-Step Implementation

Step 1: Deploy a Basic Cluster & Workload

Using  eksctl , launch a demo cluster:
eksctl create cluster
--name demo-eks
--region ap-south-1
--nodes 2
--node-type t3.medium

Verify your node setup:
kubectl get nodes

Step 2: Grant Least-Privilege IAM Access

Avoid hardcoding long-term access keys. Instead, use IAM Roles for Service Accounts (IRSA) or EKS Pod Identity so your application pod only accesses what it needs.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListBucket",
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::my-secure-eks-bucket"
},
{
"Sid": "ReadWriteObjects",
"Effect": "Allow",
"Action": ["s3:GetObject", "s3:PutObject"],
"Resource": "arn:aws:s3:::my-secure-eks-bucket/*"
}
]
}
Note:  s3:ListBucket  targets the bucket ARN, whereas object actions ( GetObject / PutObject ) require the trailing  /* .


Step 3: Enforce Insecure Transport Denial on S3

Attach a bucket policy that explicitly denies any non-HTTPS requests:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyInsecureTransport",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::my-secure-eks-bucket",
"arn:aws:s3:::my-secure-eks-bucket/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}


Key Takeaways & Mistakes to Avoid

  • Delete Practice Clusters: EKS control planes charge hourly ($0.10/hr). Run  eksctl delete cluster --name demo-eks  when finished.
  • Block Public Access: Keep S3 Block Public Access enabled at both account and bucket levels.
  • Use Persistent Volumes: Don't rely on local container storage for database workloads on EKS—use the AWS EBS CSI driver instead.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article