This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
Your code here with triple ticks on seperate lines above AND below the code | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
policies: | |
- name: test-iam-role | |
resource: iam-role | |
filters: | |
- or: | |
- type: value | |
key: AssumeRolePolicyDocument.Statement[0].Principal.Service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are 161 resources in c7n v0.8.46.1 | |
There are 171 resources in c7n v0.9.1.0 | |
New Resources Added between two schemas: | |
backup-vault | |
elasticache-group | |
emr-security-configuration | |
glue-catalog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
policies: | |
- name: ami-public-remediate-realtime | |
mode: | |
type: cloudtrail | |
events: | |
- source: "ec2.amazonaws.com" | |
event: "ModifyImageAttribute" | |
ids: "requestParameters.imageId" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
import random | |
def lambda_handler(event, context): | |
dynamodb = boto3.client('dynamodb') | |
Records = event['Records'] | |
print(json.dumps(event)) | |
for Record in Records: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filters: | |
- or: | |
- "tag:ResourceContact": absent | |
- not: | |
- type: value | |
key: "tag:ResourceContact" | |
op: regex | |
value: (^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$) | |
- type: value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: no-ec2-public-ips-realtime | |
resource: ec2 | |
description: | | |
If a EC2 instance is launched with a public IP attached initially | |
it will get terminated. | |
mode: | |
type: cloudtrail | |
events: | |
- RunInstances | |
filters: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## CloudWatch-To-Elasticsearch-Metrics-Ingester.py Script written by Jamison Roberts | |
## | |
## Description: This script is written in Python 3 and uses the AWS boto3 python library to make bulk calls to AWS S3 and CloudWatch services. | |
## A CSV of all Federated AWS accounts and names is downloaded from S3 and then the script performs a for loop on each account. | |
## Within each account the script will perform a for loop on each region specified, create a cloudwatch boto3 client, and then | |
## query CloudWatch Metrics to pull metrics counts for each metric provided in the call. Then the total returned metrics count | |
## for each account are totalled and printed on the console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
policies: | |
- name: eks-mark-waiting | |
mode: | |
type: periodic | |
schedule: "rate(10 minutes)" | |
packages: | |
- botocore | |
- boto3 | |
- urllib3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
policies: | |
################################################### | |
### First Tag the Creator of the IAM User ##### | |
################################################### | |
- name: iam-auto-tag-user | |
resource: iam-user | |
mode: | |
packages: [boto3, botocore, urllib3] |
NewerOlder