Skip to content

Instantly share code, notes, and snippets.

@arc279
Last active December 24, 2019 07:15
Show Gist options
  • Save arc279/cee9f0248715f9d28c02a98f394c74e4 to your computer and use it in GitHub Desktop.
Save arc279/cee9f0248715f9d28c02a98f394c74e4 to your computer and use it in GitHub Desktop.
awscli で elasticache の arn が引けないので手で作るやつ
###
# make elasticache arn
###
export AWS_REGION := ap-northeast-1
# ex) arn:aws:elasticache:us-west-2:1234567890:cluster:my-cluster
.PHONY: arn
arn: fetch
@ cat c.json \
| jq '.CacheClusters[].CacheClusterId' \
| jq --slurpfile i i.json \
-r '"arn:aws:elasticache:\(env.AWS_REGION):\($$i[0].Account):cluster:\(.)"'
.PHONY: fetch
fetch: c.json i.json
c.json:
@ aws elasticache describe-cache-clusters | tee $@
i.json:
@ aws sts get-caller-identity | tee $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment