simonireilly / saas-stack

Multi-tenant POC for federated identities with AWS CDK
saas-stack.vercel.app
27 stars 1 forks source link

API Gateway Tenant Policy #1

Closed simonireilly closed 3 years ago

simonireilly commented 3 years ago

Update the authenticated user policy to have the following:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": ["s3:ListBucket"],
      "Effect": "Allow",
      "Resource": ["arn:aws:s3:::mybucket"],
      "Condition": {"StringLike": {"s3:prefix": ["${aws:username}/*"]}}
    },
    {
      "Action": [
        "s3:GetObject",
        "s3:PutObject"
      ],
      "Effect": "Allow",
      "Resource": ["arn:aws:s3:::mybucket/${aws:username}/*"]
    }
  ]
}

Where, {aws:username} is substituted with any of the available tags.

simonireilly commented 3 years ago

There is a working example on the site now :+1: