Giter Site home page Giter Site logo

chadkluck / serverless-webservice-template-for-pipeline-atlantis Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.62 MB

3rd step and tutorial for creating AWS Serverless web services. A template for a API Gateway-Lambda function that is ready to be deployed using the serverless-deploy-pipeline-atlantis as the CI/CD. Utilizes built in caching using S3 and DynamoDb.

License: MIT License

JavaScript 90.41% Shell 9.59%
aws aws-lambda aws-lambda-node cloudformation cloudformation-stacks lambda tutorial aws-sam serverless

serverless-webservice-template-for-pipeline-atlantis's Issues

Stage stage shows up in API Gateway

There is an extra stage called Stage that shows up in API Gateway.

Add the following to Globals in the CF template:

Globals:

# [.......]

  Api:
    OpenApiVersion: 3.0.0 # Prevents extra stage called Stage in API Gateway https://www.internetkatta.com/how-to-prevent-aws-sam-from-creating-the-default-stage-in-api-gateway-stage

S3 Buckets should require requests to use Secure Socket Layer

Add a bucket policy for the App and Cache data storage:

# [...........]
# Place after the bucket definition

  # -- S3 Bucket Policy for Lambda App Data Storage --
  AppDataS3BucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref AppDataS3Bucket
      PolicyDocument:
        Statement:
              - Sid: "DenyNonSecureTransportAccess"
                Effect: Deny
                Principal: "*"
                Action: "s3:*"
                Resource:
                  - !GetAtt AppDataS3Bucket.Arn
                  - !Join [ '', [ !GetAtt AppDataS3Bucket.Arn, '/*' ] ]
                Condition:
                  Bool:
                    "aws:SecureTransport": false

Add npm audit and update Artifact section in buildspec

There is a way to run an npm audit for vulnerabilities and fail the deployment if there are vulnerable packages. This seems like a good thing to add to a template to make the application more secure.

  pre_build:
    commands:
      # Install dependencies needed for application
      - cd app
      - npm ci

      # Perform a fix to move us forward, then check to make sure there were no unresolved high fixes
      - npm audit fix --force
      - npm audit --audit-level=high
      
      - cd ..

      # Generate Key in SSM for cache
      - chmod a+x tools/generate-put-keys.sh
      - tools/generate-put-keys.sh $PARAM_STORE_PATH "256" $AWS_REGION $ACCOUNT_ID 

Since we are doing an install, we should bring those artifacts over with:

artifacts:
  files:
    - '**/*'
    # - template-export.yml
    # - template-configuration.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.