sam pipeline bootstrap
This page provides reference information for the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI)
sam local pipeline bootstrap subcommand.
For an introduction to the Amazon SAM CLI, see What is the Amazon SAM CLI?
The sam pipeline bootstrap subcommand generates the required Amazon infrastructure resources to connect to your CI/CD
system. This step must be run for each deployment stage in your pipeline prior to running the sam pipeline init command.
This subcommand sets up the following Amazon infrastructure resources:
-
Option of configuring pipeline permissions through:
-
A pipeline IAM user with access key ID and secret key access credentials to be shared with the CI/CD system.
Note
We recommend rotating access keys regularly. For more information, see Rotate access keys regularly for use cases that require long-term credentials in the IAM User Guide.
-
Supported CI/CD platforms through OIDC. For an introduction on using OIDC with Amazon SAM pipeline, go to How to use OIDC authentication with Amazon SAM pipelines.
-
-
An Amazon CloudFormation execution IAM role assumed by Amazon CloudFormation to deploy the Amazon SAM application.
-
An Amazon S3 bucket to hold the Amazon SAM artifacts.
-
Optionally, an Amazon ECR image repository to hold container image Lambda deployment packages (if you have a resource that is of package type
Image).
Usage
$sam pipeline bootstrap<options>
Options
--bitbucket-repo-uuidTEXT-
The UUID of the Bitbucket repository. This option is specific to using Bitbucket OIDC for permissions.
Note
This value can be found at https://bitbucket.org/
workspace/repository/admin/addon/admin/pipelines/openid-connect --bucketTEXT-
The ARN of the Amazon S3 bucket that holds the Amazon SAM artifacts.
--cicd-providerTEXT-
The CI/CD platform for the Amazon SAM pipeline.
--cloudformation-execution-roleTEXT-
The ARN of the IAM role to be assumed by Amazon CloudFormation while deploying the application's stack. Provide only if you want to use your own role. Otherwise, the command will create a new role.
--config-envTEXT-
The environment name that specifies the default parameter values in the configuration file to use. The default value is
default. For more information about configuration files, see Amazon SAM CLI configuration file. --config-filePATH-
The path and file name of the configuration file containing the default parameter values to use. The default value is
samconfig.tomlin the root of the project directory. For more information about configuration files, see Amazon SAM CLI configuration file. --confirm-changeset | --no-confirm-changeset-
Prompt to confirm the deployment of your resources.
--create-image-repository | --no-create-image-repository-
Specify whether to create an Amazon ECR image repository if none is provided. The Amazon ECR repository holds the container images of Lambda functions, or layers having a package type of
Image. The default is--no-create-image-repository. --debug-
Turns on debug logging and prints debug messages that the Amazon SAM CLI generates, and to display timestamps.
--deployment-branchTEXT-
Name of the branch that deployments will occur from. This option is specific to using GitHub Actions OIDC for permissions.
--github-orgTEXT-
The GitHub organization that the repository belongs to. If no organization exists, enter the user name of the repository owner. This option is specific to using GitHub Actions OIDC for permissions.
--github-repoTEXT-
Name of the GitHub repository that deployments will occur from. This option is specific to using GitHub Actions OIDC for permissions.
--gitlab-groupTEXT-
The GitLab group that the repository belongs to. This option is specific to using GitLab OIDC for permissions.
--gitlab-projectTEXT-
The GitLab project name. This option is specific to using GitLab OIDC for permissions.
--help, -h-
Shows this message and exits.
--image-repositoryTEXT-
The ARN of an Amazon ECR image repository that holds the container images of Lambda functions, or layers that have a package type of
Image. If provided, the--create-image-repositoryoptions is ignored. If not provided and--create-image-repositoryis specified, the command creates one. --interactive | --no-interactive-
Disable interactive prompting for bootstrap parameters and fail if any required parameters are missing. The default value is
--interactive. For this command,--stageis the only required parameter.Note
If
--no-interactiveis specified along with--use-oidc-provider, all required parameters for your OIDC provider must be included. --oidc-client-idTEXT-
The client ID configured for use with your OIDC provider.
--oidc-provider[github-actions | gitlab | bitbucket-pipelines]-
Name of the CI/CD provider that will be used for OIDC permissions. GitLab, GitHub, and Bitbucket are supported.
--oidc-provider-urlTEXT-
The URL for the OIDC provider. Value must begin with
https://. --permissions-provider[oidc | iam]-
Choose a permissions provider to assume the pipeline execution role. The default value is
iam. --pipeline-execution-roleTEXT-
The ARN of the IAM role to be assumed by the pipeline user to operate on this stage. Provide only if you want to use your own role. If not provided, this command will create a new role.
--pipeline-userTEXT-
The Amazon Resource Name (ARN) of the IAM user having its access key ID and secret access key shared with the CI/CD system. It is used to grant this IAM user permission to access the corresponding Amazon account. If not provided, the command will create an IAM user along with the access key ID and secret access key credentials.
--profileTEXT-
The specific profile from your credential file that gets Amazon credentials.
--regionTEXT-
The Amazon Region to deploy to. For example,
us-east-1. --save-params-
Save the parameters that you provide at the command line to the Amazon SAM configuration file.
--stageTEXT-
The name of the corresponding deployment stage. It is used as a suffix for the created Amazon infrastructure resources.
Troubleshooting
Error: Missing required parameter
When --no-interactive is specified along with
--use-oidc-provider and any of the required parameters are not provided, this
error message will be displayed along with a description of the missing parameters.
Example
The following example creates the Amazon resources required to create your CI/CD system, and it turns on debug logging and prints debug messages generated by the Amazon SAM CLI:
uses a generated event for local testing by using an s3.json event to invoke a Lambda function locally
$sam pipeline bootstrap --debug