serverless-aws-sns-apple-cert-date
checks AppleCertificateExpirationDate on AWS SNS and send slack when expiring, powered by AWS Lambda.
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
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
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. | - |
$ AWS_ACCESS_KEY_ID=<...> AWS_SECRET_ACCESS_KEY=<...> make deploy
$ AWS_ACCESS_KEY_ID=<...> AWS_SECRET_ACCESS_KEY=<...> sls logs -f <function name> -t