Using Amazon Lambda with Amazon Application Composer - Amazon Lambda
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Using Amazon Lambda with Amazon Application Composer

Amazon Application Composer is a visual builder for desiging modern applications on Amazon. You design your application architecture by dragging, grouping, and connecting Amazon Web Services in a visual canvas. Application Composer creates infrastructure as code (IaC) templates from your design that you can deploy using Amazon SAM or Amazon CloudFormation.

Exporting a Lambda function to Application Composer

You can get started using Application Composer by creating a new project based on the configuration of an existing Lambda function using the Lambda console. To export your function's configuration and code to Application Composer to create a new project, do the following:

  1. Open the Functions page of the Lambda console.

  2. Select the function you want to use as a basis for your Application Composer project.

  3. In the Function overview pane, choose Export to Application Composer.

    To export your function's configuration and code to Application Composer, Lambda creates an Amazon S3 bucket in your account to temporarily store this data.

  4. In the dialog box, choose Confirm and create project to accept the default name for this bucket and export your function's configuration and code to Application Composer.

  5. (Optional) To choose another name for the Amazon S3 bucket that Lambda creates, enter a new name and choose Confirm and create project. Amazon S3 bucket names must be globally unique and follow the bucket naming rules.

  6. To save your project and function files in Application Composer, activate local sync mode.

Note

If you've used the Export to Application Composer feature before and created an Amazon S3 bucket using the default name, Lambda can re-use this bucket if it still exists. Accept the default bucket name in the dialog box to re-use the existing bucket.

Amazon S3 transfer bucket configuration

The Amazon S3 bucket that Lambda creates to transfer your function's configuration automatically encrypts objects using the AES 256 encryption standard. Lambda also configures the bucket to use the bucket owner condition to ensure that only your Amazon Web Services account is able to add objects to the bucket.

Lambda configures the bucket to automatically delete objects 10 days after they are uploaded. However, Lambda doesn't automaticaly delete the bucket itself. To delete the bucket from your Amazon Web Services account, follow the instructions in Deleting a bucket. The default bucket name uses the prefix lambdasam, a 10-digit alphanumeric string, and the Amazon Web Services Region you created your function in:

lambdasam-06f22da95b-us-east-1

To avoid additional charges being added to your Amazon Web Services account, we recommend that you delete the Amazon S3 bucket as soon as you have finished exporting your function to Application Composer.

Standard Amazon S3 pricing applies.

Required permissions

To use the Lambda integration with Application Composer feature, you need certain permissions to download an Amazon SAM template and to write your function's configuration to Amazon S3.

To download an Amazon SAM template, you must have permission to use the following API actions:

You can grant permission to use all of these actions by adding the AWSLambda_ReadOnlyAccess Amazon managed policy to your IAM user role.

For Lambda to write your function's configuration to Amazon S3, you must have permission to use the following API actions:

If you are unable to export your function's configuration to Application Composer, check that your account has the required permissions for these operations. If you have the required permissions, but still cannot export your function's configuration, check for any resource-based policies that might limit access to Amazon S3.

Other resources

For a more detailed tutorial on how to design a serverless application in Application Composer based on an existing Lambda function, see Using Lambda with infrastructure as code (IaC).

To use Application Composer and Amazon SAM to design and deploy a complete serverless application using Lambda, you can also follow the Amazon Application Composer tutorial in the Amazon Serverless Patterns Workshop.