# AWS Lambda with Serverless ``` % serverless deploy --stage production --verbose To ensure safe major version upgrades ensure "frameworkVersion" setting in service configuration (recommended setup: "frameworkVersion: ^3.22.0") Deploying chazhuang to stage production (us-east-1) Packaging Retrieving CloudFormation stack Creating CloudFormation stack Creating new change set Waiting for new change set to be created Change Set did not reach desired state, retrying Executing created change set CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - chazhuang-production CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy CREATE_COMPLETE - AWS::CloudFormation::Stack - chazhuang-production Uploading Uploading CloudFormation file to S3 Uploading State file to S3 Uploading service application.jar file to S3 (15.85 MB) Updating CloudFormation stack Creating new change set Waiting for new change set to be created Change Set did not reach desired state, retrying Executing created change set UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - chazhuang-production CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetUnderscorenewsUnderscorecategoriesLogGroup CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi CREATE_COMPLETE - AWS::ApiGateway::RestApi - ApiGatewayRestApi CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetUnderscorenewsUnderscorecategoriesLogGroup CREATE_COMPLETE - AWS::Logs::LogGroup - GetUnderscorenewsUnderscorecategoriesLogGroup CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourcePing CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourcePing CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourcePing CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingOptions CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingOptions CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodPingOptions CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution CREATE_IN_PROGRESS - AWS::Lambda::Function - GetUnderscorenewsUnderscorecategoriesLambdaFunction CREATE_IN_PROGRESS - AWS::Lambda::Function - GetUnderscorenewsUnderscorecategoriesLambdaFunction CREATE_COMPLETE - AWS::Lambda::Function - GetUnderscorenewsUnderscorecategoriesLambdaFunction CREATE_IN_PROGRESS - AWS::Lambda::Version - GetUnderscorenewsUnderscorecategoriesLambdaVersionXbQULo576IVjrzmU2qUM37m0s4tyYymKnoTQonRFE CREATE_IN_PROGRESS - AWS::Lambda::Permission - GetUnderscorenewsUnderscorecategoriesLambdaPermissionApiGateway CREATE_IN_PROGRESS - AWS::Lambda::Permission - GetUnderscorenewsUnderscorecategoriesLambdaPermissionApiGateway CREATE_IN_PROGRESS - AWS::Lambda::Version - GetUnderscorenewsUnderscorecategoriesLambdaVersionXbQULo576IVjrzmU2qUM37m0s4tyYymKnoTQonRFE CREATE_COMPLETE - AWS::Lambda::Version - GetUnderscorenewsUnderscorecategoriesLambdaVersionXbQULo576IVjrzmU2qUM37m0s4tyYymKnoTQonRFE CREATE_COMPLETE - AWS::Lambda::Permission - GetUnderscorenewsUnderscorecategoriesLambdaPermissionApiGateway CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingGet CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingPost CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingPost CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingGet CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodPingGet CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodPingPost CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1664865488789 CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1664865488789 CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1664865488789 UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - chazhuang-production UPDATE_COMPLETE - AWS::CloudFormation::Stack - chazhuang-production Retrieving CloudFormation stack Removing old service artifacts from S3 ✔ Service deployed to stack chazhuang-production (150s) endpoints: GET - https://722xh9vh6d.execute-api.us-east-1.amazonaws.com/production/ping POST - https://722xh9vh6d.execute-api.us-east-1.amazonaws.com/production/ping functions: get_news_categories: chazhuang-production-get_news_categories (16 MB) Stack Outputs: GetUnderscorenewsUnderscorecategoriesLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:718286959245:function:chazhuang-production-get_news_categories:2 ServiceEndpoint: https://722xh9vh6d.execute-api.us-east-1.amazonaws.com/production ServerlessDeploymentBucketName: chazhuang-production-serverlessdeploymentbucket-1fp1zskpzsn2v ``` --- ``` % serverless deploy --verbose To ensure safe major version upgrades ensure "frameworkVersion" setting in service configuration (recommended setup: "frameworkVersion: ^3.22.0") Deploying chazhuang to stage dev (us-east-1) Packaging Retrieving CloudFormation stack Creating CloudFormation stack Creating new change set Waiting for new change set to be created Change Set did not reach desired state, retrying Executing created change set CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - chazhuang-dev CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy CREATE_COMPLETE - AWS::CloudFormation::Stack - chazhuang-dev Uploading Uploading CloudFormation file to S3 Uploading State file to S3 Uploading service application.jar file to S3 (15.85 MB) Updating CloudFormation stack Creating new change set Waiting for new change set to be created Change Set did not reach desired state, retrying Executing created change set UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - chazhuang-dev CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetUnderscorenewsUnderscorecategoriesLogGroup CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution CREATE_COMPLETE - AWS::ApiGateway::RestApi - ApiGatewayRestApi CREATE_IN_PROGRESS - AWS::Logs::LogGroup - GetUnderscorenewsUnderscorecategoriesLogGroup CREATE_COMPLETE - AWS::Logs::LogGroup - GetUnderscorenewsUnderscorecategoriesLogGroup CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourcePing CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourcePing CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourcePing CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingOptions CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingOptions CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodPingOptions CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution CREATE_IN_PROGRESS - AWS::Lambda::Function - GetUnderscorenewsUnderscorecategoriesLambdaFunction CREATE_IN_PROGRESS - AWS::Lambda::Function - GetUnderscorenewsUnderscorecategoriesLambdaFunction CREATE_COMPLETE - AWS::Lambda::Function - GetUnderscorenewsUnderscorecategoriesLambdaFunction CREATE_IN_PROGRESS - AWS::Lambda::Version - GetUnderscorenewsUnderscorecategoriesLambdaVersionx0bfrIsTaxG4pSJDa64JSLKvNAiBaKqkQ8FWDOLtA CREATE_IN_PROGRESS - AWS::Lambda::Permission - GetUnderscorenewsUnderscorecategoriesLambdaPermissionApiGateway CREATE_IN_PROGRESS - AWS::Lambda::Permission - GetUnderscorenewsUnderscorecategoriesLambdaPermissionApiGateway CREATE_IN_PROGRESS - AWS::Lambda::Version - GetUnderscorenewsUnderscorecategoriesLambdaVersionx0bfrIsTaxG4pSJDa64JSLKvNAiBaKqkQ8FWDOLtA CREATE_COMPLETE - AWS::Lambda::Version - GetUnderscorenewsUnderscorecategoriesLambdaVersionx0bfrIsTaxG4pSJDa64JSLKvNAiBaKqkQ8FWDOLtA CREATE_COMPLETE - AWS::Lambda::Permission - GetUnderscorenewsUnderscorecategoriesLambdaPermissionApiGateway CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingGet CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingPost CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingGet CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodPingPost CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodPingGet CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodPingPost CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1664865844271 CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1664865844271 CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1664865844271 UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - chazhuang-dev UPDATE_COMPLETE - AWS::CloudFormation::Stack - chazhuang-dev Retrieving CloudFormation stack Removing old service artifacts from S3 ✔ Service deployed to stack chazhuang-dev (137s) endpoints: GET - https://0grot2pbme.execute-api.us-east-1.amazonaws.com/dev/ping POST - https://0grot2pbme.execute-api.us-east-1.amazonaws.com/dev/ping functions: get_news_categories: chazhuang-dev-get_news_categories (16 MB) Stack Outputs: GetUnderscorenewsUnderscorecategoriesLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:718286959245:function:chazhuang-dev-get_news_categories:2 ServiceEndpoint: https://0grot2pbme.execute-api.us-east-1.amazonaws.com/dev ServerlessDeploymentBucketName: chazhuang-dev-serverlessdeploymentbucket-ekrllvg4kg7x ``` --- ## References - [Spring Boot Rest API deployed in AWS Lambda (Serverless) Git lab CI/CD](https://blogs.ashrithgn.com/spring-boot-rest-api-deployed-in-aws-lambda-serverless/amp/) - [Quick start Spring Boot2](https://github.com/awslabs/aws-serverless-java-container/wiki/Quick-start---Spring-Boot2) - [Week of Java: Part 4 - A Multi-layer Core for Your Function](https://www.serverless.com/blog/week-of-java-part-4-a-multi-layer-core-for-your-function) - [HTTP API (API Gateway v2)](https://www.serverless.com/framework/docs/providers/aws/events/http-api) - [Serverless.yml Reference](https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml) - [How to create a REST API in Java using DynamoDB and Serverless](https://www.serverless.com/blog/how-to-create-a-rest-api-in-java-using-dynamodb-and-serverless) - [How we captured AJAX requests from a website tab with a Chrome Extension](https://www.moesif.com/blog/technical/apirequest/How-We-Captured-AJAX-Requests-with-a-Chrome-Extension/)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up