A Simple Build.spec File
version: 0.2 phases: install: commands: # Install dependencies needed for running tests - npm install # Upgrade AWS CLI to the latest version - pip install --upgrade awscli pre_build: commands: # Discover and run unit tests in the 'tests' directory - npm test build: commands: # Use AWS SAM to package the application using AWS CloudFormation - aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.yml - aws cloudformation package --template template.staging.yml --s3-bucket $S3_BUCKET --output-template template-export.staging.yml - aws cloudformation package --template template.prod.yml --s3-bucket $S3_BUCKET --output-template template-export.prod.yml artifacts: type: zip files: - template-export.yml - template-export.staging.yml - template-export.prod.yml
version: 0.2 phases: install: commands: # Install dependencies needed for running tests - npm install # Upgrade AWS CLI to the latest version - pip install --upgrade awscli pre_build: commands: # Discover and run unit tests in the 'tests' directory - npm test build: commands: # Use AWS SAM to package the application using AWS CloudFormation - aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.yml artifacts: type: zip files: - template-export.yml
A Generic Template.yml
AWSTemplateFormatVersion: 2010-09-09 Transform: - AWS::Serverless-2016-10-31 - AWS::CodeStar Parameters: ProjectId: Type: String Description: AWS CodeStar projectID used to associate new resources to team members Environment: Type: String Description: AWS CodeStar projectID used to associate new resources to team members Resources: LambdaVersion: Type: "AWS::Lambda::Version" Properties: FunctionName : arn:aws:lambda:us-east-1:954459734159:function:awscodestar-binance-bot-lambda-HelloWorld-16Q9TC43G164R HelloWorld: Type: AWS::Serverless::Function Description: 'a funky func' Properties: AutoPublishAlias: devers Handler: index.handler Runtime: nodejs6.10 Environment: Variables: NODE_ENV: !Ref 'Environment' Role: Fn::ImportValue: !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']] Events: GetEvent: Type: Api Properties: Path: / Method: get