To configure your AWS CodePipeline pipeline to automate the build and deployment of your AWS SAM application, your AWS CloudFormation template and buildspec.yml file must contain lines that do the following:
Reference a build container image with the necessary runtime from the available images. The following example uses the public.ecr.aws/sam/build-nodejs14.x build container image.
Configure the pipeline stages to run the necessary AWS SAM command line interface (CLI) commands. The following example runs two AWS SAM CLI commands: sam build and sam deploy (with necessary options).