Due to some maintenance issues, this service has been switched in read-only mode, you can find more information about the why

and how to migrate your plugin documentation in this blogpost

Skip to end of metadata
Go to start of metadata

AWS SAM

The AWS Serverless Application Model (SAM) is an open-source framework you can use to build serverless applications on AWS.

This plugin helps you automate the deployments of your applications that are defined using SAM.

Features

  • Custom build step
  • Deploy SAM projects to AWS
  • Package SAM projects to a S3
    • Use specific or auto-generated S3 bucket (if not given, a bucket will be automatically generated in your account for you)
  • Template parameter support
  • Template tags support
  • Deploy to specific region
  • Use an S3 prefix for packaged artifacts to have fine-grained control of where artifacts are uploaded
  • Use a specific KMS key for encrypting packaged artifacts at rest in S3
  • Configurable deployment role

Requirements

AWS Account

In order to deploy to AWS you must have an AWS account. Visit https://aws.amazon.com if you do not have one.

AWS Credential Configuration

Before you can start building, you must have your AWS credentials set up in Jenkins.
To do this:

  1. From the main page of your jenkins server go to "Credentials" > "System" and then click on "Global Credentials."

  2. Click "Add Credentials."

  3. Select from the "Kind" dropdown "AWS Credentials."
  4. Finish the form with your AWS access keys and click "OK."

Project Configuration

There are a few steps to configuring your build.

  1. In your project configuration, scroll down to build steps.
  2. Add the "AWS SAM deploy application" build step.

Configuring the Build Step

  1. Select your AWS Credentials from the dropdown.
  2. Select the target region to deploy to.
  3. Give the build step a stack name.
  4. OPTIONAL: Enter an S3 bucket name to package the artifacts to.
    1. If you leave this blank, the S3 bucket will be auto-generated.
  5. Give the path to the SAM template file.

  6. Optional: If your template has parameters, add parameters where necessary.
  7. Optional: Add any tags to the stack you'd like.

  8. Optional: Finish the "Advanced" configuration
    1. Give an S3 prefix to package the artifacts in the bucket under.
    2. Give a KMS Key ID to encrypt the packaged artifacts.
    3. Give a Role Arn that will be assumed by CloudFormation when executing the changeset.
  9. Select an output template file for the package step to output to.




2 Comments

  1. Unknown User (aaron_s)

    Are there any plans to add support to allow access to project parameters? An example use case would be if building from a git repository based on a tag, to include that tag in the template script in same way, or to just simple pass along dynamic tags to the entire stack based on the build, versus hard-coding in the AWS SAM build definition.

  2. Unknown User (rnhurt)

    This plugin looks pretty good, but I have a couple of suggestions that would make it much better:

    • provide the ability to do things other than deploy.  I would like the ability to execute tests, run a build, or even just package the Lambda function to S3.
    • use the Jenkins' instance IAM credentials instead of entering custom ones.