How to use the @aws-cdk/aws-lambda.Code.bucket function in @aws-cdk/aws-lambda

To help you get started, we’ve selected a few @aws-cdk/aws-lambda examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github guardian / editions / projects / aws / lib / aws-stack.ts View on Github external
const backendProps = (
            publicationStage: 'preview' | 'published',
        ): FunctionProps => ({
            functionName: `editions-${publicationStage}-backend-${stageParameter.valueAsString}`,
            runtime: lambda.Runtime.NODEJS_10_X,
            memorySize: 512,
            timeout: Duration.seconds(60),
            code: Code.bucket(
                deployBucket,
                `${stackParameter.valueAsString}/${stageParameter.valueAsString}/backend/backend.zip`,
            ),
            handler: 'index.handler',
            environment: {
                CAPI_KEY: capiKeyParameter.valueAsString,
                arn: frontsRoleARN.valueAsString,
                stage: stageParameter.valueAsString,
                atomArn: atomLambdaParam.valueAsString,
                psurl: printSentURLParameter.valueAsString,
                IMAGE_SALT: imageSalt.valueAsString,
                publicationStage,
            },
            initialPolicy: [
                new iam.PolicyStatement({
                    actions: ['sts:AssumeRole'],
github guardian / editions / projects / aws / lib / aws-stack.ts View on Github external
new CfnOutput(this, 'archiver-state-machine-arn', {
            description: 'ARN for archiver state machine',
            exportName: `archiver-state-machine-arn-${stageParameter.valueAsString}`,
            value: archiverStateMachine.stateMachineArn,
        })

        const archiveS3EventListener = new lambda.Function(
            this,
            'EditionsArchiverS3EventListener',
            {
                functionName: `editions-archiver-s3-event-listener-${stageParameter.valueAsString}`,
                runtime: lambda.Runtime.NODEJS_10_X,
                timeout: Duration.minutes(5),
                memorySize: 256,
                code: Code.bucket(
                    deployBucket,
                    `${stackParameter.valueAsString}/${stageParameter.valueAsString}/archiver/archiver.zip`,
                ),
                handler: 'index.invoke',
                environment: {
                    stage: stageParameter.valueAsString,
                    stateMachineARN: archiverStateMachine.stateMachineArn,
                },
            },
        )

        new CfnOutput(this, 'archiver-s3-event-listener-arn', {
            description: 'ARN for archiver state machine trigger lambda',
            exportName: `archiver-s3-event-listener-arn-${stageParameter.valueAsString}`,
            value: archiveS3EventListener.functionArn,
        })
github guardian / editions / projects / aws / lib / step-function.ts View on Github external
}: {
        scope: cdk.Construct
        stack: string
        stage: string
        deployBucket: s3.IBucket
        outputBucket: s3.IBucket
    },
    environment?: { [key: string]: string },
    overrides?: Partial,
) => {
    return new lambda.Function(scope, `EditionsArchiver${toTitleCase(name)}`, {
        functionName: `editions-archiver-stepmachine-${name}-${stage}`,
        runtime: lambda.Runtime.NODEJS_10_X,
        timeout: Duration.minutes(5),
        memorySize: 1500,
        code: Code.bucket(
            deployBucket,
            `${stack}/${stage}/archiver/archiver.zip`,
        ),
        handler: `index.${name}`,
        environment: {
            ...environment,
            stage: stage,
            bucket: outputBucket.bucketName,
        },
        initialPolicy: [
            new iam.PolicyStatement({
                actions: ['*'],
                resources: [
                    outputBucket.arnForObjects('*'),
                    outputBucket.bucketArn,
                ],
github guardian / editions / projects / aws / lib / constructs.ts View on Github external
stage,
        deployBucket,
        outputBucket,
        frontsTopicArn,
        frontsTopicRole,
    }: Params,
    environment?: { [key: string]: string },
    overrides?: Partial,
) => {
    const lambdaName = `EditionsArchiver${toTitleCase(name)}`
    const fn = new lambda.Function(scope, lambdaName, {
        functionName: `editions-archiver-stepmachine-${name}-${stage}`,
        runtime: lambda.Runtime.NODEJS_10_X,
        timeout: Duration.minutes(5),
        memorySize: 1500,
        code: Code.bucket(
            deployBucket,
            `${stack}/${stage}/archiver/archiver.zip`,
        ),
        handler: `index.${name}`,
        environment: {
            ...environment,
            stage: stage,
            bucket: outputBucket.bucketName,
            topic: frontsTopicArn,
            role: frontsTopicRole.roleArn,
        },
        initialPolicy: [
            new iam.PolicyStatement({
                actions: ['*'],
                resources: [
                    outputBucket.arnForObjects('*'),