[fixed] how to create log group?

aws

#1

I think this is a simple job.

$ serverless create --template aws-nodejs --path my-service
$ cd my-service

# add a new resource `AWS::Logs::LogGroup` into `serverless.yml`

$ cat serverless.yml

service:  my-service

provider:
  name: aws
  runtime: nodejs6.10

functions:
  hello:
    handler: handler.hello

resources:
  Resources:
    AccessLogs:
      Type: AWS::Logs::LogGroup
      Properties:
        LogGroupName: /aws/apigateway/${self:service}-AccessLogs

When run sls deploy, there is no any error. But I don’t see the log group /aws/apigateway/my-service-AccessLogs is created.

Check the cloudformation template cloudformation-template-update-stack.json, two logs groups need be created.

"HelloLogGroup": {
  "Type": "AWS::Logs::LogGroup",
  "Properties": {
    "LogGroupName": "/aws/lambda/my-service-dev-hello"
  }
},

"AccessLogs": {
  "Type": "AWS::Logs::LogGroup",
  "Properties": {
    "LogGroupName": "/aws/apigateway/my-service-AccessLogs"
  }
}

but why I can’t see it in cloudwatch?

Any hints for me?


#2

I finally saw an error when click its resource from the related cloudformation stack:

There was an error loading Log Streams. Please try again by refreshing this page.

Fix

I fixed it with the answer from aws:

https://forums.aws.amazon.com/message.jspa?messageID=623472

Could you try going through the process at https://portal.aws.amazon.com/billing/signup?type=resubscribe and then verify if you still see the error?
The problem might be that accounts created long time ago would not subscribe to new services automatically. Going through above process will make the account subscribed to all existing services and future new services.
Similar post: https://forums.aws.amazon.com/message.jspa?messageID=618428

This is my first time to know this resubscribe feature. Good to know.

Another fix

Furthermore, I met the same problem in another aws account, which need an extra step:

here is the link to activate the services on the account:
https://aws-portal.amazon.com/gp/aws/developer/registration/index.html
Once the services are activated and support, the EULA is signed.

Seems the owner to apply the account forgot to active EULA (End user license agreement). After actived EULA and resubscribe, the problem is fixed.


#3

are you able to figure out why two log groups are being created? even you have give only one to create