Skip to content

Add a construct to make/schedule AWS API calls #2538

@jogold

Description

@jogold

The cdk could benefit from an AwsLambda or ScheduledAwsLambda construct that could be used like this:

new ScheduledAwsLambda(this, 'StopInstance', {
  service: 'RDS',
  action: 'stopDBInstance',
  parameters: {
    DBInstanceIdentifier: '...',
  },
  scheduleExpression: 'cron(0 1 * * ? *)'
});

new ScheduledAwsLambda(this, 'StartExecution', {
  service: 'StepFunctions',
  action: 'startExecution',
  parameters: {
    stateMachineArn: '...',
  },
  scheduleExpression: 'cron(0 1 * * ? *)',
});

The lambda function takes the service, action and parameter as event and simply makes the call using aws-sdk-js.

See also discussion started in #1850

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions