Skip to content

Instantly share code, notes, and snippets.

@mgjam
Created October 27, 2019 16:44
Show Gist options
  • Save mgjam/d305f80b3458c304f72f1137dbfbb5cb to your computer and use it in GitHub Desktop.
Save mgjam/d305f80b3458c304f72f1137dbfbb5cb to your computer and use it in GitHub Desktop.
private createApiAccessGroup(
api: appsync.CfnGraphQLApi
): iam.Group {
const name = 'ApiAccessGroup';
const group = new iam.Group(this, name, {
groupName: name
});
group.attachInlinePolicy(this.createApiAccessPolicy(api));
return group;
}
private createApiAccessPolicy(
api: appsync.CfnGraphQLApi
): iam.Policy {
const name = 'ApiAccessPolicy';
return new iam.Policy(this, name, {
policyName: name,
statements: [new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
actions: [ 'appsync:GraphQL' ],
resources: [ api.attrArn + '/*' ]
})]
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment