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 | EC2 instance profile | EC2 mounts the file system and reads objects directly from S3 |
The file system role was created in File System. This page creates the EC2 compute 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 EC2 compute role. Required
Role name
s3files-compute-role-ec2, instance profiles3files-ec2-instance-profile.compute-trust-ec2.json cat > /tmp/compute-trust-ec2.json <<EOF{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Principal": { "Service": "ec2.amazonaws.com" },"Action": "sts:AssumeRole"}]}EOFaws iam create-role \--role-name s3files-compute-role-ec2 \--assume-role-policy-document file:///tmp/compute-trust-ec2.json -
Attach managed policies. Required
Attach
AmazonS3FilesClientFullAccessto allow mounting the file system:Terminal window aws iam attach-role-policy \--role-name s3files-compute-role-ec2 \--policy-arn arn:aws:iam::aws:policy/AmazonS3FilesClientFullAccessAttach
AmazonSSMManagedInstanceCoreso the instance can register with Systems Manager — required for the EC2 launch walkthrough (Session Manager shell, no SSH):Terminal window aws iam attach-role-policy \--role-name s3files-compute-role-ec2 \--policy-arn arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore -
Attach an inline S3 read policy. Required
compute-s3-read-ec2.json cat > /tmp/compute-s3-read-ec2.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-ec2 \--policy-name S3FilesComputeS3ReadPolicy \--policy-document file:///tmp/compute-s3-read-ec2.json -
Create the instance profile and add the role. Required
Terminal window aws iam create-instance-profile --instance-profile-name s3files-ec2-instance-profileaws iam add-role-to-instance-profile \--instance-profile-name s3files-ec2-instance-profile \--role-name s3files-compute-role-ec2
Next step
Section titled “Next step”Continue to Security Groups to open port 2049 between the EC2 instance and mount targets.