Last active
August 3, 2021 17:32
-
-
Save Sigler/6ea9fb12e79a760bfc0611f4df200f08 to your computer and use it in GitHub Desktop.
Revisions
-
Sigler revised this gist
Aug 3, 2021 . 1 changed file with 1 addition and 1 deletion.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 @@ -1,7 +1,6 @@ summary: Remove unused EC2 key pairs workflow-loop: - set: prod parameters: - aws-connection: aws-prod-cac @@ -14,6 +13,7 @@ workflow-loop: aws-awsRegion: eu-west-2 - aws-connection: aws-prod-apne awsRegion: ap-northeast-2 # only showing 5 of 500 - set: dev - connection: aws-dev-foo -
Sigler revised this gist
Aug 3, 2021 . 1 changed file with 19 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 @@ -3,19 +3,17 @@ summary: Remove unused EC2 key pairs workflow-loop: # only showing 5 of 500 - set: prod parameters: - aws-connection: aws-prod-cac awsRegion: ca-central-1 - aws-connection: aws-prod-euc awsRegion: eu-central-1 - aws-connection: aws-prod-euw1 awsRegion: eu-west-1 - aws-connection: aws-prod-euw2 aws-awsRegion: eu-west-2 - aws-connection: aws-prod-apne awsRegion: ap-northeast-2 - set: dev - connection: aws-dev-foo @@ -24,9 +22,9 @@ workflow-loop: awsRegion: us-east-1 parameters: aws-connection: description: The target account default: my-aws-account awsRegion: description: The AWS region to run in default: us-east-1 @@ -41,23 +39,22 @@ triggers: schedule: '0 * * * *' binding: parameters: awsRegion: us-east-1 dryRun: true steps: - name: describe-instances image: relaysh/aws-ec2-step-instances-describe spec: aws: connection: ${parameters.aws-connection} region: ${parameters.awsRegion} - name: describe-key-pairs image: relaysh/aws-ec2-step-key-pairs-describe spec: connection: ${parameters.aws-connection} region: ${parameters.awsRegion} - name: filter-key-pairs image: relaysh/core:latest-python @@ -79,6 +76,6 @@ steps: spec: aws: # This uses a separate connection named awsAdmin. What kind of issues does this surface? connection: ${parameters.aws-connection} region: ${parameters.awsRegion} keyPairNames: !Output {from: filter-key-pairs, name: keyPairNames} -
Sigler revised this gist
Aug 2, 2021 . 1 changed file with 13 additions and 6 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 @@ -3,16 +3,19 @@ summary: Remove unused EC2 key pairs workflow-loop: # only showing 5 of 500 - set: prod variables: awsRegion: us-east-1 parameters: - connection: aws-prod-cac awsRegion: {{awsRegion}} - connection: aws-prod-euc awsRegion: {{awsRegion}} - connection: aws-prod-euw1 awsRegion: {{awsRegion}} - connection: aws-prod-euw2 awsRegion: {{awsRegion}} - connection: aws-prod-apne awsRegion: {{awsRegion}} - set: dev - connection: aws-dev-foo @@ -21,6 +24,9 @@ workflow-loop: awsRegion: us-east-1 parameters: connection: description: The target account default: awsRegion: description: The AWS region to run in default: us-east-1 @@ -43,7 +49,8 @@ steps: image: relaysh/aws-ec2-step-instances-describe spec: aws: connection: ${parameters.connection} # connection: ${connections.aws.{{my-aws-account}}} region: ${parameters.{{awsRegion}}} - name: describe-key-pairs -
Sigler revised this gist
Aug 2, 2021 . 1 changed file with 1 addition and 1 deletion.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 @@ -6,7 +6,7 @@ workflow-loop: - connection: aws-prod-cac awsRegion: ca-central-1 - connection: aws-prod-euc awsRegion: eu-central-2 - connection: aws-prod-euw1 awsRegion: eu-west-1 - connection: aws-prod-euw2 -
Sigler revised this gist
Aug 2, 2021 . 1 changed file with 1 addition and 0 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 @@ -71,6 +71,7 @@ steps: when: ${parameters.dryrun == 'false'} spec: aws: # This uses a separate connection named awsAdmin. What kind of issues does this surface? connection: ${connections.aws.awsAdmin} region: ${parameters.{{awsRegion}}} keyPairNames: !Output {from: filter-key-pairs, name: keyPairNames} -
Sigler revised this gist
Aug 2, 2021 . 1 changed file with 3 additions and 2 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 @@ -1,6 +1,7 @@ summary: Remove unused EC2 key pairs workflow-loop: # only showing 5 of 500 - set: prod - connection: aws-prod-cac awsRegion: ca-central-1 @@ -17,7 +18,7 @@ workflow-loop: - connection: aws-dev-foo awsRegion: us-west-1 - connection: aws-dev-bar awsRegion: us-east-1 parameters: awsRegion: @@ -70,6 +71,6 @@ steps: when: ${parameters.dryrun == 'false'} spec: aws: connection: ${connections.aws.awsAdmin} region: ${parameters.{{awsRegion}}} keyPairNames: !Output {from: filter-key-pairs, name: keyPairNames} -
Sigler created this gist
Aug 2, 2021 .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,75 @@ summary: Remove unused EC2 key pairs workflow-loop: - set: prod - connection: aws-prod-cac awsRegion: ca-central-1 - connection: aws-prod-euc awsRegion: eu-central-dos - connection: aws-prod-euw1 awsRegion: eu-west-1 - connection: aws-prod-euw2 awsRegion: eu-west-2 - connection: aws-prod-apne awsRegion: ap-northeast-1 - set: dev - connection: aws-dev-foo awsRegion: us-west-1 - connection: aws-dev-bar awsRegion: us-west-1 parameters: awsRegion: description: The AWS region to run in default: us-east-1 dryRun: description: True if you dont want to actually delete the resources. Use this to test the workflow and ensure it is behaving as expected. default: 'true' triggers: - name: schedule source: type: schedule schedule: '0 * * * *' binding: parameters: awsRegion: {{awsRegion}} dryRun: true steps: - name: describe-instances image: relaysh/aws-ec2-step-instances-describe spec: aws: connection: ${connections.aws.{{my-aws-account}}} region: ${parameters.{{awsRegion}}} - name: describe-key-pairs image: relaysh/aws-ec2-step-key-pairs-describe spec: connection: ${connections.aws.{{my-aws-account}}} region: ${parameters.{{awsRegion}}} - name: filter-key-pairs image: relaysh/core:latest-python spec: instances: !Output {from: describe-instances, name: instances} keyPairs: !Output { from: describe-key-pairs, name: keyPairs} inputFile: https://raw.githubusercontent.com/puppetlabs/relay-workflows/master/ec2-remove-unused-key-pairs/filter-key-pairs.py - name: approval description: Wait for approval to delete key pairs type: approval dependsOn: filter-key-pairs when: ${parameters.dryrun == 'false'} - name: delete-key-pairs dependsOn: approval image: relaysh/aws-ec2-step-key-pairs-delete when: ${parameters.dryrun == 'false'} spec: aws: connection: ${connections.aws.{{my-aws-account}}} region: ${parameters.{{awsRegion}}} keyPairNames: !Output {from: filter-key-pairs, name: keyPairNames}