IAM
Progress checklist
Overview
Section titled “Overview” S3FILES
Amazon S3 Files — a service that exposes an S3 bucket as a shared NFS file system. Supports EC2, EKS, ECS (Fargate), and Lambda. Uses the CLI namespace `aws s3files` and mount type `-t s3files`. Read APIs are `list-*` and `get-*` (for example `list-file-systems`, `get-file-system`), not `describe-*`. requires exactly two IAM
Identity and Access Management — the AWS service that controls permissions for all resources. S3 Files requires two IAM roles: one for the file system and one for the compute resource. roles:
| Role | Who assumes it | Purpose |
|---|---|---|
| File system role | elasticfilesystem.amazonaws.com | S3 Files reads/writes the bucket and manages EventBridge sync rules |
| Compute role | Lambda execution role | Lambda mounts the file system and reads objects directly from S3 |
The file system role was created in File System. This page creates the Lambda execution role.
-
Confirm base exports. Required
Re-run these in your current shell so all required variables are set:
Terminal window export AWS_REGION=ap-southeast-6export ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)export BUCKET=my-s3-files-bucket # ← replace with your real bucket nameexport BUCKET_ARN=arn:aws:s3:::${BUCKET}echo "Region: $AWS_REGION Account: $ACCOUNT_ID Bucket ARN: $BUCKET_ARN" -
Create the Lambda execution role. Required
Role name
s3files-compute-role-lambda(execution role for the function).compute-trust-lambda.json cat > /tmp/compute-trust-lambda.json <<EOF{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Principal": { "Service": "lambda.amazonaws.com" },"Action": "sts:AssumeRole"}]}EOFaws iam create-role \--role-name s3files-compute-role-lambda \--assume-role-policy-document file:///tmp/compute-trust-lambda.json -
Attach managed policies. Required
Attach
AmazonS3FilesClientFullAccessto allow mounting the file system:Terminal window aws iam attach-role-policy \--role-name s3files-compute-role-lambda \--policy-arn arn:aws:iam::aws:policy/AmazonS3FilesClientFullAccessAttach
AWSLambdaBasicExecutionRoleto allow writing to CloudWatch Logs:Terminal window aws iam attach-role-policy \--role-name s3files-compute-role-lambda \--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole -
Attach an inline S3 read policy. Required
compute-s3-read-lambda.json cat > /tmp/compute-s3-read-lambda.json <<EOF{"Version": "2012-10-17","Statement": [{"Sid": "S3ObjectReadAccess","Effect": "Allow","Action": ["s3:GetObject", "s3:GetObjectVersion"],"Resource": "${BUCKET_ARN}/*"},{"Sid": "S3BucketListAccess","Effect": "Allow","Action": "s3:ListBucket","Resource": "${BUCKET_ARN}"}]}EOFaws iam put-role-policy \--role-name s3files-compute-role-lambda \--policy-name S3FilesComputeS3ReadPolicy \--policy-document file:///tmp/compute-s3-read-lambda.json
Next step
Section titled “Next step”Continue to Security Groups to open port 2049 between the Lambda function and mount targets.