Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

invoke lambda after cdk deploy

// Using Custom resources
const checkExecutionLambda = new lambda.Function(this, 'CheckExecutionFunction', {
    runtime: lambda.Runtime.NODEJS_12_X,
    handler: 'step-func.handler',
    code: lambda.Code.fromAsset(path.join(__dirname, '../lambda')),
    memorySize: 256,
    timeout: cdk.Duration.minutes(15),
    // tracing: lambda.Tracing.ACTIVE,
    environment: {
        STATE_MACHINE_ARN: ecrStateMachine.stateMachineArn
    }
});    

//Run checkExecutionLambda on Create
const lambdaTrigger = new cr.AwsCustomResource(this, 'StatefunctionTrigger', {
    policy: cr.AwsCustomResourcePolicy.fromStatements([new iam.PolicyStatement({
        actions: ['lambda:InvokeFunction'],
        effect: iam.Effect.ALLOW,
        resources: [checkExecutionLambda.functionArn]
    })]),
    timeout: cdk.Duration.minutes(15),
    onCreate: {
        service: 'Lambda',
        action: 'invoke',
        parameters: {
            FunctionName: checkExecutionLambda.functionName,
            InvocationType: 'Event'
        },
        physicalResourceId: cr.PhysicalResourceId.of('JobSenderTriggerPhysicalId')
    },
    onUpdate: {
        service: 'Lambda',
        action: 'invoke',
        parameters: {
            FunctionName: checkExecutionLambda.functionName,
            InvocationType: 'Event'
        },
        physicalResourceId: cr.PhysicalResourceId.of('JobSenderTriggerPhysicalId')
    }
})
Comment

PREVIOUS NEXT
Code Example
Typescript :: typescript array of empty objects 
Typescript :: stacks and its operaaton code 
Typescript :: no corners in broder css 
Typescript :: react components for login 
Typescript :: typescript to java converter 
Typescript :: how to check if object is undefined in typescript 
Typescript :: typescript generic of multiple type 
Typescript :: react functional components setstate callback 
Typescript :: difference in minutes between 2 time inputs laravel 
Typescript :: generic typescript 
Typescript :: nullish coalescing typescript 
Typescript :: mongodb nest.js 
Typescript :: share data across tab through localstorage 
Typescript :: angular bind colspan to ts variable 
Typescript :: Which coutnry doesnt have taxes 
Typescript :: bootstrap get elements id 
Typescript :: basic of angular typescript 
Typescript :: typescript public function 
Typescript :: Find more than one child node with `children` in ResizeObserver. Please use ResizeObserver.Collection instead in React/ant design [antd] 
Typescript :: Associate of Arts in Broadcast Media Arts 
Typescript :: deleting a generated lib in nx 
Typescript :: how to get both key and value of enum in typescript 
Typescript :: function which calculates the number of tweets that were posted per day. 
Typescript :: Pick<Pick<Pick<DetailedHTMLProps<HTMLAttributes<HTMLDivElement, HTMLDivElement 
Typescript :: Creates new angular app 
Typescript :: flutter fab covers widget on keyboard open 
Typescript :: Show that the speed of the spacecraft in its orbit is 3.7 × 103ms –1. 
Typescript :: object map of the http parameters mutually exclusive with fromString 
Typescript :: MInus points of exploration 
Typescript :: nest js decorator 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =