Created
January 14, 2021 15:31
-
-
Save leantorres73/a04620e3e079aa11a5562455291cd803 to your computer and use it in GitHub Desktop.
Policy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const authRole = iam.Role.fromRoleArn(this, 'AuthRole', `arn:aws:iam::${Stack.of(this).region}:${Stack.of(this).account}:role/CognitoDefaultAuthenticatedRole`); | |
// Policy for Cognito invoking API Gateway | |
new iam.Policy(this, `${repositoryName}-Policy`, { | |
policyName: `${repositoryName}-Policy`, | |
roles: [authRole], | |
statements: [ | |
new iam.PolicyStatement({ | |
effect: iam.Effect.ALLOW, | |
resources: [ | |
`arn:aws:execute-api:${Stack.of(this).region}:${Stack.of(this).account}:${apigatewaysocket.ref}/*/$connect` | |
], | |
actions: [ | |
'execute-api:Invoke' | |
] | |
}), | |
new iam.PolicyStatement({ | |
effect: iam.Effect.DENY, | |
resources: [ | |
`arn:aws:execute-api:${Stack.of(this).region}:${Stack.of(this).account}:${apigatewaysocket.ref}/*/secret` | |
], | |
actions: [ | |
'execute-api:Invoke' | |
] | |
}), | |
new iam.PolicyStatement({ | |
effect: iam.Effect.DENY, | |
resources: [ | |
`arn:aws:execute-api:${Stack.of(this).region}:${Stack.of(this).account}:${apigatewaysocket.ref}/*` | |
], | |
actions: [ | |
'execute-api:ManageConnections' | |
] | |
}) | |
] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment