Application Model AWS Serverless

1y ago
45 Views
11 Downloads
2.76 MB
364 Pages
Last View : 7d ago
Last Download : 3m ago
Upload by : Helen France
Transcription

AWS ServerlessApplication ModelDeveloper Guide

AWS Serverless Application Model Developer GuideAWS Serverless Application Model: Developer GuideCopyright Amazon Web Services, Inc. and/or its affiliates. All rights reserved.Amazon's trademarks and trade dress may not be used in connection with any product or service that is notAmazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages ordiscredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who mayor may not be affiliated with, connected to, or sponsored by Amazon.

AWS Serverless Application Model Developer GuideTable of ContentsWhat is AWS SAM? . 1Benefits of using AWS SAM . 1Next step . 2Getting started . 3Installing the AWS SAM CLI . 3Linux . 3Windows . 10macOS . 12Setting up AWS credentials . 15Using the AWS CLI . 16Not using the AWS CLI . 16Tutorial: Hello World application . 16Prerequisites . 17Step 1: Download a sample AWS SAM application . 17Step 2: Build your application . 18Step 3: Deploy your application to the AWS Cloud . 19Step 4: (Optional) Test your application locally . 22Troubleshooting . 24Clean up . 26Conclusion . 26Next steps . 26AWS SAM specification . 27Template anatomy . 27YAML . 27Template sections . 28Next steps . 29Globals . 29Resource and property reference . 33AWS::Serverless::Api . 33AWS::Serverless::Application . 66AWS::Serverless::Function . 69AWS::Serverless::HttpApi . 138AWS::Serverless::LayerVersion . 158AWS::Serverless::SimpleTable . 161AWS::Serverless::StateMachine . 164Resource attributes . 184Exceptions . 184Intrinsic functions . 185Generated resources . 185Referencing generated AWS CloudFormation resources . 185Generated AWS CloudFormation resource scenarios . 186AWS::Serverless::Api . 187AWS::Serverless::Application . 188AWS::Serverless::Function . 189AWS::Serverless::HttpApi . 192AWS::Serverless::LayerVersion . 194AWS::Serverless::SimpleTable . 194AWS::Serverless::StateMachine . 194API Gateway extensions . 195Authoring . 197Validating AWS SAM template files . 197Working with layers . 197Including layers in your application . 198How layers are cached locally . 198iii

AWS Serverless Application Model Developer GuideUsing nested applications . 199Defining a nested application from the AWS Serverless Application Repository . 200Defining a nested application from the local file system . 201Deploying nested applications . 201Controlling access to APIs . 201Choosing a mechanism to control access . 203Customizing error responses . 203Examples . 203Lambda authorizer examples . 204IAM permission example . 206Amazon Cognito user pool example . 206API key example . 207Resource policy example . 208OAuth 2.0/JWT authorizer example . 208Customized response example . 209Orchestrating applications . 210Example . 210More information . 211Code signing . 211Example . 211Providing signing profiles with sam deploy --guided . 213Building . 214Building applications . 214Building a .zip file archive . 214Building a container image . 215Container environment variable file . 215Examples . 216Building Node.js Lambda functions with esbuild (Preview) . 218Building layers . 219Examples . 216Building custom runtimes . 221Examples . 222Testing and debugging . 223Invoking functions locally . 223Environment variable file . 224Layers . 224Running API Gateway locally . 224Layers . 226Integrating with automated tests . 226Generating sample event payloads . 227Step-through debugging Lambda functions locally . 227Using AWS Toolkits . 228Running AWS SAM locally in debug mode . 229Passing additional runtime debug arguments . 229Deploying . 231Deploying using CI/CD systems . 231Deploying using the AWS SAM CLI . 231Troubleshooting deployments using the AWS SAM CLI . 232AWS SAM CLI error: "Security Constraints Not Satisfied" . 24Gradual deployments . 232Modify existing pipelines . 232AWS CodePipeline . 233Bitbucket Pipelines . 233Jenkins . 234GitLab CI/CD . 234GitHub Actions . 235Generating starter pipelines . 235iv

AWS Serverless Application Model Developer GuideAWS CodePipeline .Jenkins, GitLab CI/CD, GitHub Actions, Bitbucket Pipelines .Customizing starter pipelines .Example projects .Example files .Monitoring .Working with logs .Fetching logs by AWS CloudFormation stack .Fetching logs by Lambda function name .Tailing logs .Viewing logs for a specific time range .Filtering logs .Error highlighting .JSON pretty printing .Publishing .Prerequisites .Publishing a new application .Step 1: Add a Metadata section to the AWS SAM template .Step 2: Package the application .Step 3: Publish the application .Step 4: Share the application (optional) .Publishing a new version of an existing application .Additional topics .Metadata section properties .Properties .Use cases .Example .Example applications .Process DynamoDB events .Before you begin .Step 1: Initialize the application .Step 2: Test the application locally .Step 3: Package the application .Step 4: Deploy the application .Next steps .Process Amazon S3 events .Before you begin .Step 1: Initialize the application .Step 2: Package the application .Step 3: Deploy the application .Step 4: Test the application locally .Next steps .AWS CDK .Getting started .Prerequisites .Creating and locally testing an AWS CDK application .Locally testing .Example .Building .Example .Deploying .Accelerate (Preview) .Getting started .Prerequisites .Getting started tutorial .Deploying .Examples 58258259259259259261264

AWS Serverless Application Model Developer GuideMonitoring .sam logs .sam traces .AWS SAM reference .AWS SAM specification .AWS SAM CLI command reference .AWS SAM policy templates .Topics .AWS SAM CLI command reference .sam build .sam delete .sam deploy .sam init .sam local generate-event .sam local invoke .sam local start-api .sam local start-lambda .sam logs .sam package .sam pipeline bootstrap .sam pipeline init .sam publish .sam validate .AWS SAM CLI configuration file .Example .Configuration file rules .Writing configurations with sam deploy --guided .AWS SAM policy templates .Syntax .Examples .Policy template table .Troubleshooting .Policy template list .Image repositories .Image repository URIs .Examples .Deploying gradually .AWS SAM CLI telemetry .Disabling telemetry for a session .Disabling telemetry for your profile in all sessions .Types of information collected .Learn more .Permissions .Grant administrator permissions .Attach necessary AWS managed policies .Grant specific IAM permissions .Important notes .Installing AWS SAM CLI on 32-bit Windows .Document history 05342342343343345346346346347347347347348350351352

AWS Serverless Application Model Developer GuideBenefits of using AWS SAMWhat is the AWS ServerlessApplication Model (AWS SAM)?The AWS Serverless Application Model (AWS SAM) is an open-source framework that you can use to buildserverless applications on AWS.A serverless application is a combination of Lambda functions, event sources, and other resources thatwork together to perform tasks. Note that a serverless application is more than just a Lambda function—it can include additional resources such as APIs, databases, and event source mappings.You can use AWS SAM to define your serverless applications. AWS SAM consists of the followingcomponents: AWS SAM template specification. You use this specification to define your serverless application.It provides you with a simple and clean syntax to describe the functions, APIs, permissions,configurations, and events that make up a serverless application. You use an AWS SAM template fileto operate on a single, deployable, versioned entity that's your serverless application. For the full AWSSAM template specification, see AWS Serverless Application Model (A

AWS Serverless Application Model Developer Guide Benefits of using AWS SAM What is the AWS Serverless Application Model (AWS SAM)? The AWS Serverless Application Model (AWS SAM) is an open-source framework that you can use to build serverless applications on AWS.

Related Documents:

4 AWS Training & Services AWS Essentials Training AWS Cloud Practitioner Essentials (CP-ESS) AWS Technical Essentials (AWSE) AWS Business Essentials (AWSBE) AWS Security Essentials (SEC-ESS) AWS System Architecture Training Architecting on AWS (AWSA) Advanced Architecting on AWS (AWSAA) Architecting on AWS - Accelerator (ARCH-AX) AWS Development Training

AWS SDK for JavaScript AWS SDK for JavaScript code examples AWS SDK for .NET AWS SDK for .NET code examples AWS SDK for PHP AWS SDK for PHP code examples AWS SDK for Python (Boto3) AWS SDK for Python (Boto3) code examples AWS SDK for Ruby AWS SDK for Ruby co

Hacking Serverless Runtimes Serverless technology is getting increasingly ubiquitous in the enterprise and startup communities. As micro-services multiply and single purpose services grow, how do you audit and defend serverless runtimes? The advantages of serverless runtimes are clear: increased

AWS Directory Amazon Aurora R5 instance Service AWS Server Migration Service AWS Snowball AWS Deep Amazon GameLift Learning AMIs AWS CodeBuild AWS CodeDeploy AWS Database Migration Service Amazon Polly 26 26 20 40 12 0 5 10 15 20 25 30 35 40 45 2018 Q1 2018 Q2 2018 Q3 2018 Q4 2019 Q1 New Services& Features on AWS

AWS instances with Nessus while in development and operations, before publishing to AWS users. Tenable Network Security offers two products on the AWS environment: Nessus for AWS is a Nessus Enterprise instance already available in the AWS Marketplace. Tenable Nessus for AWS provides pre-authorized scanning in the AWS cloud via AWS instance ID.

BSR/AWS B5.16-200x, Specification for the Qualification of Welding Engineers (revision of ANSI/AWS B5.16-2001) Obtain an electronic copy from: roneill@aws.org Order from: R. O’Neill, AWS; roneill@aws.org Send comments (with copy to BSR) to: Andrew Davis, AWS; adavis@aws.org; roneill@aws.org Single copy price: 25.00

pa/1g pa/1f pb/2f pc/2g pd/4f 156 pf/3g pf/3f pg/3g pg/3f en: pcfileur welding positions aws: 1g en: pa aws: 1f aws: 2g en: pc aws: 2f en: pb aws: 3g en: pg down en: pf up aws: 3f down en: pf aws: 4g en: pe aws: 4f en: pd 156

AutoCAD 2000 Learning Assistance, provided on a separate CD, is a multi-media learning tool that focuses on working in AutoCAD, understanding dif-ficult concepts and underutilized AutoCAD features, and collaborating with other AutoCAD professionals. AutoCAD Training Autodesk Official Training Courseware (AOTC) is the Autodesk-endorsed courseware for instructor-led training. To register for a .