Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build serverless apps with SAM Accelerate and SAM Pipelines - AWS Summit India 2022

Build serverless apps with SAM Accelerate and SAM Pipelines - AWS Summit India 2022

When building serverless applications, you have a wide range of options for building your infrastructure and developing your code. Understanding how to treat both your infrastructure and application as code can improve efficiency, build flexibility, and save time. The AWS Serverless Application Model (AWS SAM) is an open-source framework for building serverless applications.

In this session, we demonstrate how to use SAM templates to manage serverless infrastructure as code. We share best practices for using the AWS SAM CLI and the recently announced AWS SAM Accelerate to develop and debug serverless applications on your local machine. We also showcase the ease of CI/CD workflows with SAM pipelines to multiple staging environments.

Available on demand, here

Jones Zachariah Noel N

May 25, 2022
Tweet

More Decks by Jones Zachariah Noel N

Other Decks in Technology

Transcript

  1. I N D I A | M A Y 2 6 , 2 0 2 2

    View Slide

  2. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Build Serverless Apps with SAM
    Accelerate and SAM Pipelines
    Jones Zachariah Noel N
    D 1 D E V 1 0 4
    Serverless Architect
    AWS Community Builder

    View Slide

  3. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    We Will Be Looking Into
    ● Understanding SAM CLI
    ● Exploring SAM Accelerate
    ● SAM Accelerate CLI commands
    ● Need for CI/CD Pipelines for Serverless apps
    ● Building SAM Pipelines

    View Slide

  4. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Understanding SAM CLI
    • The AWS Serverless Application Model (SAM) is
    an open-source framework.
    • Develop - Local test - Deploy with CLI commands
    • Provides templates for common use-cases.
    • Leverages AWS CloudFormation for deployment.
    • Provisioning Infrastructure as Code (IaC).

    View Slide

  5. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    SAM CLI Supported Runtimes
    • NodeJS 10.x, 12.x, 14.x
    • Python 3.9, 3.8, 3.7, 3.6
    • Java 8, 11
    • DotNet 6, 5.0
    • DotNet core 2.1, 3.1
    • Go 1.x
    • Ruby 2.7
    • TypeScript

    View Slide

  6. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    SAM Accelerate

    View Slide

  7. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Exploring SAM Accelerate
    • Speeds up local development and
    synchronization to the cloud.
    • Helps with testing the application on
    the cloud.
    • Enables seamless logging and tracing
    for the SAM application.

    View Slide

  8. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Exploring SAM Accelerate
    • Uses AWS CLI based operations for fast
    deployments of AWS Lambda functions,
    AWS API Gateway and AWS Step
    Functions.
    • Is advised to be used only on the
    development AWS environment.
    • Is available with AWS SAM CLI version
    1.34.1 or greater and this is in public
    preview.

    View Slide

  9. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    SAM Accelerate CLI Commands
    Ø sam sync
    Synchronizing local code base along with configurations to the cloud stack. The
    sync command will build, package and deploy the changes to your AWS
    environment.
    Ø sam logs
    Logging multiple resources such as AWS Lambda functions, API Gateway, Step
    Functions.
    Ø sam trace
    Fetches AWS X-Ray traces in your AWS Account in the AWS Region into a local log
    stream.

    View Slide

  10. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    The Serverless Riddler
    Riddler wants to move to a
    Serverless app which retrieves his
    riddles.
    But he thinks its a lot of time to
    deploy over AWS CloudFormation
    update stack!
    Image from dcmovies.wikia.com

    View Slide

  11. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    DEMO
    GitHub : https://github.com/zachjonesnoel/sam-accelerate-aws-summit-india-2022

    View Slide

  12. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    SAM Pipelines

    View Slide

  13. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Need for CI/CD Pipelines for Serverless Apps
    ● Ensures best practices of develop - build - deliver
    ● Enhances code reliability
    ● Better transparency and accountability in different staging
    environments.
    ● Ease of maintenance
    ● Promotes Infrastructure as Code (IaC)

    View Slide

  14. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Building SAM Pipelines
    Deployment pipelines for automated cloud deployment to different
    staging environments. AWS SAM Pipelines facilitates templates for
    CI/CD pipeline providers -
    ● GitHub Actions
    ● AWS CodePipeline
    ● GitLab CI/CD
    ● Jenkins

    View Slide

  15. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    SAM Pipelines CLI Commands
    • SAM pipeline bootstrap – Use this walkthrough to setup a CI/CD
    pipeline.
    • SAM pipeline init - This command generates your CI/CD pipeline
    configuration file with the details of different stages and IAM
    permissions.
    • SAM build - This command will build your workstation with the
    SAM template and the built artifacts would be available in the .aws-
    sam/build directory.
    • SAM deploy - Using AWS CloudFormation, it will deploy the “built
    artifacts” to the designated AWS Account.

    View Slide

  16. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    How SAM Pipeline Works
    Commit code to Git repository
    Prod account
    CI/CD providers
    IAM credentials
    Prod pipeline execution role
    Prod CloudFormation
    execution role
    Prod artifact bucket
    Based on approval
    or automated test
    Staging account
    Staging pipeline execution
    role
    Staging CloudFormation
    execution role
    Staging artifact bucket

    View Slide

  17. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    The Serverless Riddler CI/CD Pipeline
    Riddler is happy with the way how
    developers can use `sam sync`
    to develop and test faster.
    Time to go live?
    Well, Riddler would want a CI/CD
    pipeline implemented before
    going live!
    Image from dcmovies.wikia.com

    View Slide

  18. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    DEMO
    GitHub : https://github.com/zachjonesnoel/sam-pipelines-aws-summit-india-2022

    View Slide

  19. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Key Takeaways
    ● Understanding the ways of enabling developer friendly approach to
    develop Serverless apps on AWS SAM.
    ● Following the best practices to ensure smooth and fast deployment.
    ● Implementing the DevOps practices with Serverless apps to ensure
    CI/CD pipelines and smarter, faster, better delivery.

    View Slide

  20. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Resources
    ● Getting Started with AWS SAM
    https://docs.aws.amazon.com/serverless-application-
    model/latest/developerguide/serverless-getting-started.html
    ● SAM Accelerate :
    https://docs.aws.amazon.com/serverless-application-
    model/latest/developerguide/accelerate.html
    ● SAM deployment :
    https://docs.aws.amazon.com/serverless-application-
    model/latest/developerguide/serverless-deploying.html
    ● Demo Source Code on GitHub :
    https://github.com/zachjonesnoel/sam-accelerate-aws-summit-india-2022

    View Slide

  21. © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Deepen your skills with digital
    learning on demand
    Access 500+ free digital courses
    and Learning Plans
    Earn an industry-recognized
    credential
    AWS Skill Builder AWS Certifications
    Explore resources with a variety
    of skill levels and 16+ languages
    to meet your learning needs
    Join the AWS Certified community
    and get exclusive benefits
    Receive Foundational,
    Associate, Professional,
    and Specialty certifications
    Train now
    Access new
    exam guides
    © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Learn in-demand AWS Cloud Skills

    View Slide

  22. Thank you!
    © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
    Jones Zachariah Noel N
    Twitter: @zachjonesnoel
    Github: zachjonesnoel
    Website: www.zachjonesnoel.com

    View Slide

  23. Please complete
    the session survey
    © 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.

    View Slide