serverless-aws-sns-apple-cert-date

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 14 Imported by: 0

README

serverless-aws-sns-apple-cert-date

GoDoc Release Build Status Codecov Coverage Go Report Card Code Climate BCH compliance

serverless-aws-sns-apple-cert-date checks AppleCertificateExpirationDate on AWS SNS and send slack when expiring, powered by AWS Lambda.

Download

Download serverless-aws-sns-apple-cert-date by command below.

$ git clone https://github.com/evalphobia/serverless-aws-sns-apple-cert-date
$ cd serverless-aws-sns-apple-cert-date
$ make init

Config

serverless.yml

Change environment variables below,

$ vim serverless.yml

------------

provider:
  name: aws
  region: ap-northeast-1  # <- Change to your target region.


...
functions:
  check:
    handler: bin/serverless
    memorySize: 128
    timeout: 119
    environment:
      # Change to your target Application Platform ARN of AWS SNS.
      ARN_LIST: >-
        arn:aws:sns:ap-northeast-1:000000000000:app/APNS/app1
        arn:aws:sns:ap-northeast-1:000000000000:app/APNS/app2
        arn:aws:sns:ap-northeast-1:000000000000:app/APNS/app3
        arn:aws:sns:ap-northeast-1:000000000000:app/APNS/app4
      # Change to your own threshold.
      TIME_THRESHOLD: 30d10h # 30days and 10 hours before
      # If you want to get report even if it's not in expiring, turn it to true.
      FORCE_REPORT: false

      # SLACK_WEBHOOK_URL_KMS: 'xxx'
      SLACK_WEBHOOK_URL: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
      SLACK_CHANNEL: '#channel'
    events:
      - schedule: cron(0 0 * * ? *)  # exec everyday on 00:00

Environment variables

Name Description Default
ARN_LIST Puts Application Platform ARNs on AWS SNS. -
FORCE_REPORT A flag to send the report to Slack even if not in expiring. false
TIME_THRESHOLD Expiration time threshold to send report. Besides go's ParseDuration format, it supports d for days. (ref: https://golang.org/pkg/time/#ParseDuration ) 1d
SLACK_WEBHOOK_URL Slack's webhook URL. -
SLACK_WEBHOOK_URL_KMS Slack's webhook URL encrypted by AWS KMS. false
SLACK_USERNAME A sender name on Slack. -
SLACK_CHANNEL A channel name on Slack. -

Deploy

$ AWS_ACCESS_KEY_ID=<...> AWS_SECRET_ACCESS_KEY=<...> make deploy

Check Log

$ AWS_ACCESS_KEY_ID=<...> AWS_SECRET_ACCESS_KEY=<...> sls logs -f <function name> -t

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL