Skip to content

Instantly share code, notes, and snippets.

View adamcousins's full-sized avatar

Adam Cousins adamcousins

View GitHub Profile
@sudharsans
sudharsans / PutResourcePolicy.py
Last active January 10, 2024 00:07
Resource Policy for CloudWatch Logs with CloudFormation - Route53 query log
import json
import cfnresponse
import boto3
from botocore.exceptions import ClientError
client = boto3.client("logs")
def PutPolicy(arn,policyname):
response = client.put_resource_policy(
policyName=policyname,
@g-a-d
g-a-d / gist:4bc7f716bc57e42b64e1ef450be9bae8
Created November 6, 2017 15:41
Converting CloudFormation parameter files to CodePipeline Template Configuration files
Using jq, we can convert between CloudFormation parameter files and CodePipeline template configuration files:
$ jq '{ Parameters: [ .[] | { (.ParameterKey): .ParameterValue } ] | add } ' < cloudformation_parameter_file.json
This is useful in the case of receiving 'Template configuration is not valid' when running a CloudFormation action.
A CloudFormation parameter file has format:
[
{
@pahud
pahud / delete_all_awslogs.sh.md
Last active October 18, 2023 09:13
delete all aws log groups

specify the region

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done

only delete loggroup name starting with /aws/lambda