Skip to content

Instantly share code, notes, and snippets.

@kaihendry
Created December 21, 2020 08:53
Show Gist options
  • Save kaihendry/aa4a6ab40c2b2cdb0591799b0ebb98c0 to your computer and use it in GitHub Desktop.
Save kaihendry/aa4a6ab40c2b2cdb0591799b0ebb98c0 to your computer and use it in GitHub Desktop.
Function "myservice-dev-hello" doesn't exist in this Service
(ins)[hendry@t14s s]$ sls create --template aws-go-mod --path myService
Serverless: Generating boilerplate...
Serverless: Generating boilerplate in "/tmp/s/myService"
_______ __
| _ .-----.----.--.--.-----.----| .-----.-----.-----.
| |___| -__| _| | | -__| _| | -__|__ --|__ --|
|____ |_____|__| \___/|_____|__| |__|_____|_____|_____|
| | | The Serverless Application Framework
| | serverless.com, v2.16.0
-------'
Serverless: Successfully generated boilerplate for template: "aws-go-mod"
(ins)[hendry@t14s s]$ ll
total 0
drwxrwxr-x 3 hendry users 60 Dec 21 16:46 .
drwxrwxrwt 18 root root 1.1K Dec 21 16:45 ..
drwxrwxr-x 4 hendry users 160 Dec 21 16:46 myService
(ins)[hendry@t14s s]$ cd myService/
(ins)[hendry@t14s myService]$ ll
total 16K
drwxrwxr-x 4 hendry users 160 Dec 21 16:46 .
drwxrwxr-x 3 hendry users 60 Dec 21 16:46 ..
drwxr-xr-x 2 hendry users 60 Dec 21 16:46 hello
drwxr-xr-x 2 hendry users 60 Dec 21 16:46 world
-rw-r--r-- 1 hendry users 317 Dec 21 16:46 .gitignore
-rw-r--r-- 1 hendry users 302 Dec 21 16:46 gomod.sh
-rw-r--r-- 1 hendry users 338 Dec 21 16:46 Makefile
-rw-r--r-- 1 hendry users 3.2K Dec 21 16:46 serverless.yml
(ins)[hendry@t14s myService]$ vim gomod.sh
(ins)[hendry@t14s myService]$ tree
.
├── gomod.sh
├── hello
│   └── main.go
├── Makefile
├── serverless.yml
└── world
└── main.go
2 directories, 5 files
(ins)[hendry@t14s myService]$ vim hello/main.go
(ins)[hendry@t14s myService]$ ll
total 16K
drwxrwxr-x 4 hendry users 160 Dec 21 16:46 .
drwxrwxr-x 3 hendry users 60 Dec 21 16:46 ..
drwxr-xr-x 2 hendry users 60 Dec 21 16:46 hello
drwxr-xr-x 2 hendry users 60 Dec 21 16:46 world
-rw-r--r-- 1 hendry users 317 Dec 21 16:46 .gitignore
-rw-r--r-- 1 hendry users 302 Dec 21 16:46 gomod.sh
-rw-r--r-- 1 hendry users 338 Dec 21 16:46 Makefile
-rw-r--r-- 1 hendry users 3.2K Dec 21 16:46 serverless.yml
(ins)[hendry@t14s myService]$ vim Makefile
(ins)[hendry@t14s myService]$ vim serverless.yml
(ins)[hendry@t14s myService]$ vim Makefile
(ins)[hendry@t14s myService]$ export AWS_PROFILE=gosls
(ins)[hendry@t14s myService]$ vim ~/.aws/credentials
(ins)[hendry@t14s myService]$ make
chmod u+x gomod.sh
./gomod.sh
export GO111MODULE=on
env GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
go: downloading github.com/aws/aws-lambda-go v1.6.0
env GOOS=linux go build -ldflags="-s -w" -o bin/world world/main.go
(ins)[hendry@t14s myService]$ make deploy
rm -rf ./bin ./vendor go.sum
chmod u+x gomod.sh
./gomod.sh
export GO111MODULE=on
env GOOS=linux go build -ldflags="-s -w" -o bin/hello hello/main.go
env GOOS=linux go build -ldflags="-s -w" -o bin/world world/main.go
sls deploy --verbose
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
CloudFormation - CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - myservice-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CloudFormation - CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CloudFormation - CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CloudFormation - CREATE_COMPLETE - AWS::CloudFormation::Stack - myservice-dev
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service myservice.zip file to S3 (4.4 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
CloudFormation - UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - myservice-dev
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - WorldLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HelloLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::RestApi - ApiGatewayRestApi
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::RestApi - ApiGatewayRestApi
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - HelloLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - HelloLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::Logs::LogGroup - WorldLogGroup
CloudFormation - CREATE_COMPLETE - AWS::Logs::LogGroup - WorldLogGroup
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceHello
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceHello
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourceHello
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceWorld
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Resource - ApiGatewayResourceWorld
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Resource - ApiGatewayResourceWorld
CloudFormation - CREATE_COMPLETE - AWS::IAM::Role - IamRoleLambdaExecution
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - WorldLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Function - WorldLambdaFunction
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Function - HelloLambdaFunction
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Function - WorldLambdaFunction
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionV1U4rKVdtdZBJogiDADIWG4ggVsSp6EJ3Xygn4ttv1M
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodHelloGet
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - HelloLambdaPermissionApiGateway
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodHelloGet
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - HelloLambdaPermissionApiGateway
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - HelloLambdaVersionV1U4rKVdtdZBJogiDADIWG4ggVsSp6EJ3Xygn4ttv1M
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodWorldGet
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodHelloGet
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - WorldLambdaVersionI29SVZ6JpjaoHGOoxzznhmOuajDbS5Hb1PnN2RBSlQA
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - HelloLambdaVersionV1U4rKVdtdZBJogiDADIWG4ggVsSp6EJ3Xygn4ttv1M
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - WorldLambdaPermissionApiGateway
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Method - ApiGatewayMethodWorldGet
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Permission - WorldLambdaPermissionApiGateway
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Method - ApiGatewayMethodWorldGet
CloudFormation - CREATE_IN_PROGRESS - AWS::Lambda::Version - WorldLambdaVersionI29SVZ6JpjaoHGOoxzznhmOuajDbS5Hb1PnN2RBSlQA
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Version - WorldLambdaVersionI29SVZ6JpjaoHGOoxzznhmOuajDbS5Hb1PnN2RBSlQA
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1608540457861
CloudFormation - CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1608540457861
CloudFormation - CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1608540457861
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Permission - HelloLambdaPermissionApiGateway
CloudFormation - CREATE_COMPLETE - AWS::Lambda::Permission - WorldLambdaPermissionApiGateway
CloudFormation - UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - myservice-dev
CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - myservice-dev
Serverless: Stack update finished...
Service Information
service: myservice
stage: dev
region: us-east-1
stack: myservice-dev
resources: 17
api keys:
None
endpoints:
GET - https://zulke2lvyi.execute-api.us-east-1.amazonaws.com/dev/hello
GET - https://zulke2lvyi.execute-api.us-east-1.amazonaws.com/dev/world
functions:
hello: myservice-dev-hello
world: myservice-dev-world
layers:
None
Stack Outputs
HelloLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:862322258447:function:myservice-dev-hello:1
WorldLambdaFunctionQualifiedArn: arn:aws:lambda:us-east-1:862322258447:function:myservice-dev-world:1
ServiceEndpoint: https://zulke2lvyi.execute-api.us-east-1.amazonaws.com/dev
ServerlessDeploymentBucketName: myservice-dev-serverlessdeploymentbucket-1v62vk9ttxwez
(ins)[hendry@t14s myService]$ sls logs
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless Error ---------------------------------------
This command requires the --function option / -f shortcut. Usage: The function name
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 15.4.0
Framework Version: 2.16.0
Plugin Version: 4.3.0
SDK Version: 2.3.2
Components Version: 3.4.3
(ins)[hendry@t14s myService]$ sls logs -f myservice-dev-hello
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless Error ---------------------------------------
Function "myservice-dev-hello" doesn't exist in this Service
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 15.4.0
Framework Version: 2.16.0
Plugin Version: 4.3.0
SDK Version: 2.3.2
Components Version: 3.4.3
(ins)[hendry@t14s myService]$ export AWS_PROFILE=gosls
(ins)[hendry@t14s myService]$ sls logs -f myservice-dev-hello
Serverless: Deprecation warning: Starting with next major version, API Gateway naming will be changed from "{stage}-{service}" to "{service}-{stage}".
Set "provider.apiGateway.shouldStartNameWithService" to "true" to adapt to the new behavior now.
More Info: https://www.serverless.com/framework/docs/deprecations/#AWS_API_GATEWAY_NAME_STARTING_WITH_SERVICE
Serverless Error ---------------------------------------
Function "myservice-dev-hello" doesn't exist in this Service
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 15.4.0
Framework Version: 2.16.0
Plugin Version: 4.3.0
SDK Version: 2.3.2
Components Version: 3.4.3
(ins)[hendry@t14s myService]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment