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
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
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: | |
[ | |
{ |
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 cfnresponse | |
import boto3 | |
from botocore.exceptions import ClientError | |
client = boto3.client("logs") | |
def PutPolicy(arn,policyname): | |
response = client.put_resource_policy( | |
policyName=policyname, |