constructor()

in lib/s3-stack.ts [10:30]


    constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
        super(scope, id, props);
    
        const bucket = new s3.Bucket(this, 'BuildArtifacts', {
            versioned: false, 
            publicReadAccess: false
        });

        const role = new iam.Role(this, 'S3JenkinsRole', {
            assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com'),
            description: 'This role allows Jenkins Workers to publish artifacts to S3',
        });

        role.addToPolicy(new iam.PolicyStatement({
            resources: [bucket.bucketArn],
            actions: ['s3:*'],
        }));

        this.myRole = role;

    }