├── Dashboard.png
├── .github
└── PULL_REQUEST_TEMPLATE.md
├── CODE_OF_CONDUCT.md
├── Dockerfile
├── src
├── main
│ ├── resources
│ │ ├── log4j2.xml
│ │ └── config.yaml
│ └── java
│ │ └── AWSHealthCheck
│ │ ├── Config.java
│ │ ├── AWSHelper.java
│ │ └── Lambda.java
└── sam.yaml
├── LICENSE
├── deploy.sh
├── CONTRIBUTING.md
├── README.md
├── pom.xml
└── THIRD-PARTY
/Dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/amazon-archives/aws-lambda-java-AWSHealth-check/HEAD/Dashboard.png
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | *Issue #, if available:*
2 |
3 | *Description of changes:*
4 |
5 |
6 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
7 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM amazoncorretto:8
2 | ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
3 | RUN yum install -y wget
4 | RUN wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
5 | RUN sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
6 | RUN yum install -y apache-maven && yum clean all
7 | COPY src /build/src
8 | COPY pom.xml /build
9 | WORKDIR /build
10 | RUN mvn clean package shade:shade
11 |
--------------------------------------------------------------------------------
/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | %d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this
4 | software and associated documentation files (the "Software"), to deal in the Software
5 | without restriction, including without limitation the rights to use, copy, modify,
6 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7 | permit persons to whom the Software is furnished to do so.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 |
--------------------------------------------------------------------------------
/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #Suggest deploying to us-east-1 due to SES
3 | export AWS_DEFAULT_REGION=us-east-1
4 | #Change the below, an s3 bucket to store lambda code for deploy
5 | #Must be in same region as lambda (ie DEFAULT_REGION)
6 | export CONFIG_BUCKET=changeme
7 | export CONFIG_FILE=config.yaml
8 | #Change below to set the save bucket for saving site fingerprint data.
9 | export BUCKET=changeme
10 |
11 | if [[ ! -f bin/AWSHealthCheck-1.0-SNAPSHOT.jar ]]; then
12 | echo "AWSHealthCheck-1.0-SNAPSHOT.jar not found! Run build.sh first."
13 | exit 1
14 | fi
15 |
16 | aws cloudformation package \
17 | --template-file src/sam.yaml \
18 | --output-template-file deploy.sam.yaml \
19 | --s3-bucket $CONFIG_BUCKET \
20 | --s3-prefix automate-lambda-java-AWSHealth-check-build
21 | aws cloudformation deploy \
22 | --template-file deploy.sam.yaml \
23 | --stack-name automate-lambda-java-AWSHealth-check-build \
24 | --capabilities CAPABILITY_IAM \
25 | --parameter-overrides DEFAULTREGION=$AWS_DEFAULT_REGION CONFIGFILE=$CONFIG_FILE BUCKET=$BUCKET
26 |
--------------------------------------------------------------------------------
/src/main/resources/config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | # Refer to https://docs.aws.amazon.com/health/latest/APIReference/API_EventFilter.html for limitations of filter
3 | # Regions to check for the AWSHealth API data (cannot exceed 10)
4 | # "global" Region is for "global services" not tied to specific Regions; ex.: IAM, Route53, MarketPlace
5 | regions:
6 | - "global"
7 | - "ap-northeast-1"
8 | - "ap-northeast-2"
9 | # - "ap-northeast-3"
10 | # - "ap-south-1"
11 | # - "ap-southeast-1"
12 | # - "ap-southeast-2"
13 | # - "ca-central-1"
14 | # - "eu-central-1"
15 | - "eu-west-1"
16 | # - "eu-west-2"
17 | # - "eu-west-3"
18 | # - "sa-east-1"
19 | - "us-east-1"
20 | - "us-east-2"
21 | - "us-west-1"
22 | - "us-west-2"
23 |
24 | # Category to check for the AWSHealth API data
25 | category:
26 | - "issue"
27 | - "scheduledChange"
28 | - "accountNotification"
29 |
30 | # Status codes to check for for the AWSHealth API data
31 | status:
32 | - "open"
33 | - "upcoming"
34 | # - "closed"
35 |
36 | # Resource tags to filter for for the AWSHealth API data
37 | tags:
38 | # - {"key": "value"}
39 | # - {"key2": "value"}
40 |
41 | # SES settings
42 | ses_region: "us-east-1"
43 | ses_from: "changeme@domain.com" # Sender
44 | ses_send: "changeme@domain.com,changeme2@domain.com" # Recipient list separated by comma
45 |
46 | # Email template for sending blocked IP found notification.
47 | email_template: "check-AWSHealth\n\n
48 | New AWSHealth API update(s) found: \n\n
49 | %s\n"
50 | ...
--------------------------------------------------------------------------------
/src/main/java/AWSHealthCheck/Config.java:
--------------------------------------------------------------------------------
1 | package AWSHealthCheck;
2 |
3 | import java.util.Collection;
4 | import java.util.List;
5 | import java.util.Map;
6 |
7 | public class Config {
8 | private List regions;
9 | private List category;
10 | private List status;
11 | private Collection