Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Last active December 17, 2018 22:29
Show Gist options
  • Select an option

  • Save adrianhall/b29c05b0adb44d904d333f25a4731f3d to your computer and use it in GitHub Desktop.

Select an option

Save adrianhall/b29c05b0adb44d904d333f25a4731f3d to your computer and use it in GitHub Desktop.
UnauthRole:
Type: AWS::IAM::Role
Properties:
RoleName: ${self:custom.api}-unauth
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Federated: cognito-identity.amazonaws.com
Action: sts:AssumeRoleWithWebIdentity
Condition:
ForAnyValue:StringLike:
"cognito-identity.amazonaws.com:amr": "unauthenticated"
Policies:
- PolicyName: AllowProfilePictureDownload
PolicyDocument:
Version: "2012-10-17"
Statement:
- Action:
- "s3:GetObject"
Effect: Allow
Resource:
- { Fn::GetAtt: [ FileStorage, Arn ]}
- { Fn::Join: [ "/", [{ Fn::GetAtt: [ FileStorage, Arn ]}, "*" ]]}
- PolicyName: AllowUnauthenticatedAppSyncQueries
PolicyDocument:
Version: "2012-10-17"
Statement:
- Action:
- "appsync:GraphQL"
Effect: Allow
Resource:
- { Fn::Join: [ "/", [{ Fn::GetAtt: [ GraphQlApi, Arn ]}, "types/Query/*" ]]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment