This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-base/function/archive/aws

47 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/bash
# aws cli from docker image on any machine
function aws() {
AWS_CLI_IMAGE=${AWS_CLI_IMAGE:-amazon/aws-cli:latest}
AWS_WORKING_DIR=${AWS_WORKING_DIR:-$HOME/awscli}
local cmd
cmd="docker run --rm -ti
--env AWS_ACCESS_KEY_ID
--env AWS_CONFIG_FILE
--env AWS_SHARED_CREDENTIALS_FILE
--env AWS_SECRET_ACCESS_KEY
--env AWS_DEFAULT_REGION
-v ${HOME}/.aws:/root/.aws
-v ${AWS_WORKING_DIR}:/aws
${AWS_CLI_IMAGE} $*
--no-cli-pager
"
# echo ${cmd}
# local res
echo "$(eval ${cmd})"
# echo $RES
}
# `! [ -z $AWS_ACCESS_KEY_ID ] && echo "--env AWS_ACCESS_KEY_ID"` \
# `! [ -z $AWS_SECRET_ACCESS_KEY ] && echo "--env AWS_SECRET_ACCESS_KEY"` \
# `! [ -z $AWS_DEFAULT_REGION ] && echo "--env AWS_DEFAULT_REGION"` \
test () {
echo $(aws route53 list-hosted-zones)
}
aws-get-zone-id () {
local records
local domain
domain=$(get-domain $1)
echo $domain
aws route53 list-hosted-zones --query "'HostedZones[?Name==\`${domain}.\`]'"
echo returned
echo $RES
# local res
# res=$(echo $records | grep ID | awk -F'[\"#]+' '{print $4}' | awk -F'[/#]+' '{print $3}')
# echo "$res"
}