Skip to content

Commit

Permalink
Automating the listing of AMIs from the original JSON template
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbrown committed Nov 27, 2020
1 parent a3f2dec commit a51fd3b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Makefile
Expand Up @@ -18,3 +18,13 @@ download-original: ## Download the original CFN template from AT&T
convert-to-yaml: ## Convert JSON template to YAML
@ruby -e "require 'json'; require 'yaml'; puts YAML.dump(JSON.parse(File.read('$(output.file)')))" > $(yaml.file)

.PHONY: list-amis
list-amis: ## Lists the AMIs available for use with the sensor
@jq '.Mappings.RegionMap | to_entries[] | [.key, .value.AMI]' $(output.file)

.PHONY: ami
ami: ## Lists the AMI for a given REGION
ifndef REGION
@echo "You need to supply a REGION"; exit 1
endif
@jq '.Mappings.RegionMap | to_entries[] | [.key, .value.AMI] | select(.[0] == "$(REGION)")' $(output.file)

0 comments on commit a51fd3b

Please sign in to comment.