Last active
August 24, 2017 08:56
-
-
Save bsamuel-ui/cff4632e5894625bb5361646c57d1c4b to your computer and use it in GitHub Desktop.
Revisions
-
bsamuel-ui revised this gist
Jul 27, 2017 . 1 changed file with 10 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,39 +4,27 @@ Type: "AWS::Logs::LogGroup" Properties: LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName", "1234" ] ] LambdaLogGroup: Type: "AWS::Logs::LogGroup" Properties: LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName" ] ] DependsOn: "LambdaLogGroup1234" Outputs: NeedsThatName: Value: !GetAtt LambdaLogGroup.Arn ''' import boto3, os cf = boto3.client('cloudformation') stack_name = 'test-log-issue-' + str(os.getpid()) cf.create_stack(StackName=stack_name, TemplateBody=template, OnFailure='ROLLBACK') try: cf.get_waiter('stack_create_complete').wait(StackName=stack_name) except Exception: print("No love. :-(") else: print("Hooray, they fixed it!!!") finally: cf.delete_stack(StackName=stack_name) -
bsamuel-ui created this gist
Jul 27, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ template = ''' Resources: LambdaLogGroup1234: Type: "AWS::Logs::LogGroup" Properties: LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName", "1234" ] ] LambdaLogGroup: Type: "AWS::Logs::LogGroup" Properties: LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName" ] ] DependsOn: "LambdaLogGroup1234" LoggingPolicy: Type: "AWS::IAM::ManagedPolicy" Properties: Description: "CloudWatch logging" PolicyDocument: Version: "2012-10-17" Statement: - Effect: "Allow" Action: - "logs:CreateLogStream" - "logs:PutLogEvents" Resource: !GetAtt [ "LambdaLogGroup", "Arn" ] DependsOn: "LambdaLogGroup" ''' import boto3, os cf = boto3.client('cloudformation') stack_name = 'test-log-issue-' + str(os.getpid()) cf.create_stack(StackName=stack_name, TemplateBody=template, Capabilities=['CAPABILITY_IAM'], OnFailure='ROLLBACK') try: cf.get_waiter('stack_create_complete').wait(StackName=stack_name) except Exception: print("No love. :-(") else: print("Hooray, they fixed it!!!") finally: cf.delete_stack(StackName=stack_name)