aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
20 lines (16 loc) • 491 B
text/typescript
import { Construct } from 'constructs';
import { PolicyStatement, Role, ServicePrincipal } from '../lib';
export class ExampleConstruct extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
/// !show
const role = new Role(this, 'MyRole', {
assumedBy: new ServicePrincipal('sns.amazonaws.com'),
});
role.addToPolicy(new PolicyStatement({
resources: ['*'],
actions: ['lambda:InvokeFunction'],
}));
/// !hide
}
}