From: Andreas Gerler Date: Fri, 26 Feb 2016 13:02:51 +0000 (+0100) Subject: yasnippets for Amazon AWS. X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=bcb360153d90e8791ee9909d7d99d4c071e9b5b5;p=emacsconfig.git yasnippets for Amazon AWS. - more snippets for amazon aws cli --- diff --git a/snippets/eshell-mode/aws-autoscaling-describe-auto-scaling-groups b/snippets/eshell-mode/aws-autoscaling-describe-auto-scaling-groups new file mode 100644 index 00000000..2d71f0f7 --- /dev/null +++ b/snippets/eshell-mode/aws-autoscaling-describe-auto-scaling-groups @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-autoscaling-describe-auto-scaling-groups +# key: aws-autoscaling-describe-auto-scaling-groups +# -- +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value "\$\{REGION\}" bba-aws-regions)}} autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[].{Name: AutoScalingGroupName, Desired: DesiredCapacity,Min: MinSize, Max: MaxSize}' --output ${4:$$(yas-choose-value '("text" "table" "json"))} $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-autoscaling-describe-launch-configurations b/snippets/eshell-mode/aws-autoscaling-describe-launch-configurations new file mode 100644 index 00000000..ebdfb98a --- /dev/null +++ b/snippets/eshell-mode/aws-autoscaling-describe-launch-configurations @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-autoscaling-describe-launch-configurations +# key: aws-autoscaling-describe-launch-configurations +# -- +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value "\$\{REGION\}" bba-aws-regions)}} autoscaling describe-launch-configurations --query 'reverse(sort_by(LaunchConfigurations &CreatedTime)[*].[LaunchConfigurationName, CreatedTime])' --output ${4:$$(yas-choose-value '("text" "table" "json"))} $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-autoscaling-update-auto-scaling-group-min-max b/snippets/eshell-mode/aws-autoscaling-update-auto-scaling-group-min-max new file mode 100644 index 00000000..4c4c2068 --- /dev/null +++ b/snippets/eshell-mode/aws-autoscaling-update-auto-scaling-group-min-max @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-autoscaling-update-auto-scaling-group-min-max +# key: aws-autoscaling-update-auto-scaling-group-min-max +# -- +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value "\$\{REGION\}" bba-aws-regions)}} autoscaling update-auto-scaling-group --auto-scaling-group-name ${4:`(yank)`} --min-size $5 --max-size $6 $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-ec2-get-dns-names b/snippets/eshell-mode/aws-ec2-get-dns-names index fdc9456e..23d594e4 100644 --- a/snippets/eshell-mode/aws-ec2-get-dns-names +++ b/snippets/eshell-mode/aws-ec2-get-dns-names @@ -2,4 +2,4 @@ # name: aws-ec2-get-dns-names # key: aws-ec2-get-dns-names # -- -aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value bba-aws-regions)}} ec2 describe-instances --filters "Name=tag:Name,Values=$4" --query "Reservations[].Instances[?State.Name=='running'].[InstanceId, PublicDnsName]" --output ${5:$$(yas-choose-value '("table" "text" "json"))} $0 +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value bba-aws-regions)}} ec2 describe-instances --filters "Name=tag:Name,Values=$4" --query "Reservations[].Instances[?State.Name=='running'].[InstanceId, PublicDnsName]" --output ${5:$$(yas-choose-value '("text" "table" "json"))} $0 diff --git a/snippets/eshell-mode/aws-ec2-instance-running b/snippets/eshell-mode/aws-ec2-instance-running index efb8633f..2147130c 100644 --- a/snippets/eshell-mode/aws-ec2-instance-running +++ b/snippets/eshell-mode/aws-ec2-instance-running @@ -2,4 +2,4 @@ # name: aws-ec2-instance-running # key: aws-ec2-instance-running # -- -aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value bba-aws-regions)}} ec2 describe-instances --instance-ids $4 --query "Reservations[].Instances[].[InstanceId, State.Name]" --output ${5:$$(yas-choose-value '("table" "text" "json"))} $0 +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} ${2:--region=${3:$$(yas-choose-value bba-aws-regions)}} ec2 describe-instances --instance-ids $4 --query "Reservations[].Instances[].[InstanceId, State.Name]" --output ${5:$$(yas-choose-value '("text" "table" "json"))} $0 diff --git a/snippets/eshell-mode/aws-emr-list-clusters b/snippets/eshell-mode/aws-emr-list-clusters new file mode 100644 index 00000000..b8a553f1 --- /dev/null +++ b/snippets/eshell-mode/aws-emr-list-clusters @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-emr-list-clusters +# key: aws-emr-list-clusters +# -- +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} --region=${2:$$(yas-choose-value "\$\{REGION\}" bba-aws-regions)} emr list-clusters --active --query 'Clusters[*].{ID: Id, NAME: Name}' --output ${5:$$(yas-choose-value '("text" "table" "json"))} $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-filters b/snippets/eshell-mode/aws-filters new file mode 100644 index 00000000..98d421f2 --- /dev/null +++ b/snippets/eshell-mode/aws-filters @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-filters +# key: awsfil +# -- +--filters "Name=${1:$$(yas-choose-value '("tag:Name" "tag:Type" "instance.group-id" "private-ip-address"))},Values=$2" $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-regions b/snippets/eshell-mode/aws-regions new file mode 100644 index 00000000..0c8500c9 --- /dev/null +++ b/snippets/eshell-mode/aws-regions @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-regions +# key: awsreg +# -- +--region=${1:$$(yas-choose-value "\$\{REGION\}" bba-aws-regions)} $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-route53-list-hosted-zones b/snippets/eshell-mode/aws-route53-list-hosted-zones new file mode 100644 index 00000000..145558c4 --- /dev/null +++ b/snippets/eshell-mode/aws-route53-list-hosted-zones @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-route53-list-hosted-zones +# key: aws-route53-list-hosted-zones +# -- +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} route53 list-hosted-zones --query 'HostedZones[].[Id, Name]' --output ${5:$$(yas-choose-value '("text" "table" "json"))} $0 \ No newline at end of file diff --git a/snippets/eshell-mode/aws-route53-list-resource-record-sets b/snippets/eshell-mode/aws-route53-list-resource-record-sets new file mode 100644 index 00000000..0692c350 --- /dev/null +++ b/snippets/eshell-mode/aws-route53-list-resource-record-sets @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-route53-list-resource-record-sets +# key: aws-route53-list-resource-record-sets +# -- +aws --profile=${1:$$(yas-choose-value '("prod" "test"))} route53 list-resource-record-sets --hosted-zone-id ${2:`(yank)`} --query \"ResourceRecordSets[?contains(Name, '$3')].Name\" --output ${5:$$(yas-choose-value '("text" "table" "json"))} $0 \ No newline at end of file diff --git a/snippets/sh-mode/.yas-parents b/snippets/sh-mode/.yas-parents index 2de397c8..d2c5b0d0 100644 --- a/snippets/sh-mode/.yas-parents +++ b/snippets/sh-mode/.yas-parents @@ -1 +1,2 @@ eshell-mode +shell-mode \ No newline at end of file diff --git a/snippets/shell-mode/aws-iam-userlist b/snippets/shell-mode/aws-iam-userlist new file mode 100644 index 00000000..eeea8be7 --- /dev/null +++ b/snippets/shell-mode/aws-iam-userlist @@ -0,0 +1,5 @@ +# -*- mode: snippet -*- +# name: aws-iam-userlist +# key: aws-iam-userlist +# -- +for user in $(aws --profile=${1:$$(yas-choose-value '("prod" "test"))} iam list-users --query 'Users[*].UserName' --output text); do aws --profile=$1 iam list-access-keys --user-name $user --query \"AccessKeyMetadata[?Status=='Active'].[UserName, AccessKeyId]\" --output text; done $0 \ No newline at end of file