Blog | G5 Cyber Security

AWS Tenant Isolation

TL;DR

This guide shows you how to restrict access for different tenants (customers) in your AWS environment using IAM policies, VPCs, and potentially other services like KMS. It focuses on practical steps to prevent data leakage and ensure each tenant only accesses their own resources.

1. Understand Your Tenant Model

Before you start, define how tenants are separated within your application. Common models include:

This guide will focus on the Shared Account with Namespaces model as it’s more common for smaller deployments.

2. Tagging Strategy

Tags are crucial for identifying tenant resources. Establish a consistent tagging strategy:

Apply these tags to *all* relevant resources – EC2 instances, S3 buckets, databases, etc.

3. IAM Policies for Tenant Access

Create IAM policies that grant tenants access only to their tagged resources. Use the aws:ResourceTag condition key:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": "arn:aws:s3:::*", "Condition": { "StringEquals": { "aws:ResourceTag/tenant-id": "${tenantId}" } } } ] }

Replace ${tenantId} with the actual tenant ID. You’ll need to create a separate policy for each tenant or use a system to dynamically generate policies.

4. IAM Roles and Users

Create IAM roles for tenants, attaching the appropriate policies from Step 3. Assign users to these roles:

5. VPC Isolation

For increased isolation, use separate VPCs for each tenant:

This is more complex to set up but provides a stronger security boundary.

6. Data Encryption (KMS)

If you’re storing sensitive data, use AWS Key Management Service (KMS):

This ensures that even if a tenant gains unauthorized access to data storage, they cannot decrypt the data without permission.

7. Monitoring and Auditing

Implement robust monitoring and auditing:

8. Automation

Automate tenant provisioning and de-provisioning:

Exit mobile version