Skip to content

CDK app that deploys a Lambda function that gets invoked from another AWS account using Step Functions cross‑account access

Notifications You must be signed in to change notification settings

garysassano/cdk-aws-cross-account-lambda

Repository files navigation

cdk-aws-cross-account-lambda

This project makes use of the recently added cross‑account access capabilities for AWS Step Functions. Thanks to this new feature, tasks in your Step Functions workflow can take advantage of identity-based policies to directly invoke resources in other AWS accounts.

Prerequisites

  • AWS:
    • Must have completed the steps detailed in the Configuration section.
  • Node.js + npm:
  • Poetry:

Configuration

Set the following variables in your local environment:

  • CDK_ACCOUNT_SRC - The AWS account ID for the source stack (e.g. 123456789012)
  • CDK_REGION_SRC - The AWS region for the source stack (e.g. us-east-1)
  • CDK_ACCOUNT_TRG - The AWS account ID for the target stack (e.g. 123456789012)
  • CDK_REGION_TRG - The AWS region for the target stack (e.g. us-east-1)

After that, complete the CDK bootstrapping process for both the SRC and TRG accounts.

  1. Execute the command below with a user having admin privileges in the SRC account:

    cdk bootstrap aws://$CDK_ACCOUNT_SRC/$CDK_REGION_SRC
  2. Execute the command below with a user having admin privileges in the TRG account:

    cdk bootstrap aws://$CDK_ACCOUNT_TRG/$CDK_REGION_TRG --trust $CDK_ACCOUNT_SRC

Installation

npx projen install

Deployment

Must be executed as admin of the SRC account:

npx projen deploy --all --require-approval never

Cleanup

Must be executed as admin of the SRC account:

npx projen destroy --all --force

Architecture Diagram

Architecture Diagram

About

CDK app that deploys a Lambda function that gets invoked from another AWS account using Step Functions cross‑account access

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages