AWS CLI: Difference between revisions
Jump to navigation
Jump to search
(28 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
sudo ${HOME}/Downloads/aws/install | sudo ${HOME}/Downloads/aws/install | ||
rm -rf ${HOME}/Downloads/aws | rm -rf ${HOME}/Downloads/aws | ||
</syntaxhighlight> | |||
==AWS » Profile== | |||
<syntaxhighlight lang="bash"> | |||
export AWS_PROFILE=chorke.academia | |||
export AWS_PROFILE=chorke | |||
aws ec2 describe-availability-zones | |||
aws sts get-caller-identity | |||
aws configure list | |||
aws s3 ls | |||
</syntaxhighlight> | |||
==AWS » Route 53== | |||
<syntaxhighlight lang="bash"> | |||
aws route53 list-hosted-zones --output=json | |||
aws route53 list-resource-record-sets --hosted-zone-id=Z2U6EL1ZO4QJ1T --output=json | |||
</syntaxhighlight> | |||
---- | |||
<syntaxhighlight lang="bash"> | |||
export AWS_PROFILE=chorke | |||
aws route53 list-hosted-zones --output=json > aws-chorke-zones.json | |||
ZONE_NAME=chorke.org | |||
HOSTED_ZONE_ID=$(cat aws-chorke-zones.json | jq -r ".HostedZones[] | select(.Name == \"${ZONE_NAME}.\") | .Id" | cut -d'/' -f3) | |||
aws route53 list-resource-record-sets --hosted-zone-id=${HOSTED_ZONE_ID} --output=json > aws-chorke-zone-${ZONE_NAME}.json | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="A")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="MX")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="NS")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="SOA")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="TXT")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="CNAME")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="A")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="MX")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="NS")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="SOA")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="TXT")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="CNAME")' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|"\(.Name) \t\(.TTL) \t\(.Type) \t\(.AliasTarget?.DNSName)\n"' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|"\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[]?.Value)\n"' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="A")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="MX")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="TXT")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"' | |||
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="CNAME")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"' | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 11: | Line 60: | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
aws -- | cat << INI | tee -a ${HOME}/.aws/config >/dev/null | ||
aws | [default] | ||
region = ap-southeast-1 | |||
output = table | |||
INI | |||
</syntaxhighlight> | |||
| valign="top" | | |||
<syntaxhighlight lang="bash"> | |||
cat << INI | tee -a ${HOME}/.aws/credentials >/dev/null | |||
[academia] | |||
aws_access_key_id = AKIBVWTF7RISAULV8Q6Q | |||
aws_secret_access_key = w2JVkDIE9zRTIP/S4m7Mm4cWKlFEYlzg1iGzfCnj | |||
INI | |||
</syntaxhighlight> | |||
| valign="top" | | |||
<syntaxhighlight lang="bash"> | |||
cat << INI | tee -a ${HOME}/.aws/config >/dev/null | |||
[profile academia] | |||
region = ap-southeast-1 | |||
output = json | |||
INI | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign="top"| | |- | ||
| colspan="3" | | |||
---- | |||
|- | |||
| valign="top" | | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
export AWS_DEFAULT_PROFILE=academia | |||
export AWS_PROFILE=academia | |||
aws ec2 describe-vpcs | |||
aws s3 ls | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign="top"| | | valign="top" | | ||
aws kms delete-alias --alias-name \ | |||
arn:aws:kms:ap-southeast-1:235216370500:alias/eks/sdlc_cluster | |||
cat ~/.aws/credentials | |||
cat ~/.aws/config | |||
| valign="top" | | |||
aws configure --profile academia | |||
aws sts get-caller-identity | |||
aws configure list | |||
aws configure | |||
|- | |- | ||
Line 28: | Line 117: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang="bash"> | |||
kubectl config set-context minikube --cluster=minikue | |||
kubectl config set-context minikube | |||
kubectl config get-contexts | |||
kubectl config get-clusters | |||
kubectl config view | |||
</syntaxhighlight> | |||
| valign="top" | | | valign="top" | | ||
Line 39: | Line 135: | ||
|valign='top'| | |valign='top'| | ||
* [https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpcs.html AWS » CLI » EC2 » <code>describe-vpcs</code>] | * [https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpcs.html AWS » CLI » EC2 » <code>describe-vpcs</code>] | ||
* [https:// | * [https://docs.aws.amazon.com/cli/latest/reference/lightsail/ AWS » CLI » <code>lightsail</code>] | ||
* [https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html AWS » CLI » Install] | * [https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html AWS » CLI » Install] | ||
* [https://docs.aws.amazon.com/cli/latest/ AWS » CLI » Docs] | * [https://docs.aws.amazon.com/cli/latest/ AWS » CLI » Docs] | ||
* [https://docs.aws.amazon.com/cli/latest/reference/s3/ AWS » CLI » | * [https://docs.aws.amazon.com/cli/latest/reference/eks/ AWS » CLI » <code>eks</code>] | ||
* [https://docs.aws.amazon.com/cli/latest/reference/ec2/ AWS » CLI » <code>ec2</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/ecr/ AWS » CLI » <code>ecr</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/ecs/ AWS » CLI » <code>ecs</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/s3/ AWS » CLI » <code>s3</code>] | |||
* [[AWS]] | * [[AWS]] | ||
|valign='top'| | |valign='top'| | ||
* [https://docs.aws.amazon.com/cli/latest/reference/codecommit/ AWS » CLI » <code>codecommit</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/ AWS » CLI » <code>cloudwatch</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/cloudfront/ AWS » CLI » <code>cloudfront</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/eks-auth/ AWS » CLI » <code>eks-auth</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/account/ AWS » CLI » <code>account</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/route53/ AWS » CLI » <code>route53</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/s3api/ AWS » CLI » <code>s3api</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/efs/ AWS » CLI » <code>efs</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/elb/ AWS » CLI » <code>elb</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/rds/ AWS » CLI » <code>rds</code>] | |||
|valign='top'| | |||
* [https://docs.aws.amazon.com/cli/latest/reference/importexport/ AWS » CLI » <code>importexport</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/imagebuilder/ AWS » CLI » <code>imagebuilder</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/discovery/ AWS » CLI » <code>discovery</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/inspector/ AWS » CLI » <code>inspector</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/freetier/ AWS » CLI » <code>freetier</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/grafana/ AWS » CLI » <code>grafana</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/glacier/ AWS » CLI » <code>glacier</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/events/ AWS » CLI » <code>events</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/iam/ AWS » CLI » <code>iam</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/es/ AWS » CLI » <code>es</code>] | |||
|- | |||
|colspan='3'| | |||
---- | |||
|- | |||
|valign='top'| | |||
* [https://docs.aws.amazon.com/cli/latest/reference/payment-cryptography/ AWS » CLI » <code>payment-cryptography</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/medical-imaging/ AWS » CLI » <code>medical-imaging</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/machinelearning/ AWS » CLI » <code>machinelearning</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/neptune/ AWS » CLI » <code>neptune</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/pricing/ AWS » CLI » <code>pricing</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/lambda/ AWS » CLI » <code>lambda</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/kafka/ AWS » CLI » <code>kafka</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/kms/ AWS » CLI » <code>kms</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/iot/ AWS » CLI » <code>iot</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/m2/ AWS » CLI » <code>m2</code>] | |||
|valign='top'| | |||
* [https://docs.aws.amazon.com/cli/latest/reference/kms/delete-alias.html AWS » CLI » <code>kms</code> » <code>delete-alias</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/vpc-lattice/ AWS » CLI » <code>vpc-lattice</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/quicksight/ AWS » CLI » <code>quicksight</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/workspaces/ AWS » CLI » <code>workspaces</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/redshift/ AWS » CLI » <code>redshift</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/schemas/ AWS » CLI » <code>schemas</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/xray/ AWS » CLI » <code>xray</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/sdb/ AWS » CLI » <code>sdb</code>] | |||
* [https://docs.aws.amazon.com/cli/latest/reference/waf/ AWS » CLI » <code>waf</code>] | |||
* [[EKSctl|AWS » EKS » CLI]] | |||
|valign='top'| | |valign='top'| | ||
|- | |- | ||
| | |colspan='3'| | ||
---- | ---- | ||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
* [https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-access-points.html AWS » S3 » Creating an access point] | |||
* [https://docs.aws.amazon.com/AmazonS3/latest/API/RESTAuthentication.html AWS » S3 » REST Authentication] | |||
* [https://awspolicygen.s3.amazonaws.com/policygen.html AWS » S3 » Policy Generator] | |||
* [https://superuser.com/questions/279986/ AWS » S3 » cURL Upload] | * [https://superuser.com/questions/279986/ AWS » S3 » cURL Upload] | ||
* [https://stackoverflow.com/questions/44751574/ AWS » S3 » cURL Route] | * [https://stackoverflow.com/questions/44751574/ AWS » S3 » cURL Route] | ||
* [ | * [https://aws.amazon.com/s3/pricing/ AWS » S3 » Pricing] | ||
* [[ | * [[Minikube]] | ||
* [[VSCode]] | * [[VSCode]] | ||
* [[CLI App]] | * [[CLI App]] | ||
Line 63: | Line 216: | ||
|valign='top'| | |valign='top'| | ||
* [https://stackoverflow.com/questions/20337749/ AWS » CLI » Route 53 » Export DNS Zone] | |||
* [https://github.com/kubernetes-sigs/aws-ebs-csi-driver AWS » EKS » EBS CSI Driver] | |||
* [https://docs.aws.amazon.com/eks/latest/userguide/create-cluster.html AWS » EKS » Create Cluster] | |||
* [[Google Cloud CLI]] | |||
* [[Online App]] | |||
* [[Terraform]] | |||
* [[Kubectl]] | |||
|valign='top'| | |valign='top'| | ||
|} | |} |
Latest revision as of 02:55, 22 November 2024
wget -cq https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -P ${HOME}/Downloads
unzip -q ${HOME}/Downloads/awscli-exe-linux-x86_64.zip -d ${HOME}/Downloads/
rm -rf ${HOME}/Downloads/awscli-exe-linux-x86_64.zip
sudo ${HOME}/Downloads/aws/install
rm -rf ${HOME}/Downloads/aws
AWS » Profile
export AWS_PROFILE=chorke.academia
export AWS_PROFILE=chorke
aws ec2 describe-availability-zones
aws sts get-caller-identity
aws configure list
aws s3 ls
AWS » Route 53
aws route53 list-hosted-zones --output=json
aws route53 list-resource-record-sets --hosted-zone-id=Z2U6EL1ZO4QJ1T --output=json
export AWS_PROFILE=chorke
aws route53 list-hosted-zones --output=json > aws-chorke-zones.json
ZONE_NAME=chorke.org
HOSTED_ZONE_ID=$(cat aws-chorke-zones.json | jq -r ".HostedZones[] | select(.Name == \"${ZONE_NAME}.\") | .Id" | cut -d'/' -f3)
aws route53 list-resource-record-sets --hosted-zone-id=${HOSTED_ZONE_ID} --output=json > aws-chorke-zone-${ZONE_NAME}.json
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="A")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="MX")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="NS")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="SOA")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="TXT")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|select(.Type=="CNAME")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="A")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="MX")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="NS")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="SOA")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="TXT")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="CNAME")'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|"\(.Name) \t\(.TTL) \t\(.Type) \t\(.AliasTarget?.DNSName)\n"'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets[]|"\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[]?.Value)\n"'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="A")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="MX")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="TXT")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"'
cat aws-chorke-zone-${ZONE_NAME}.json | jq -jr '.ResourceRecordSets|sort_by(.Name)[]|select(.Type=="CNAME")|"\(.Name) \t1\tIN\t\(.Type) \t\(.ResourceRecords[0].Value)\n"'
Playground
cat << INI | tee -a ${HOME}/.aws/config >/dev/null
[default]
region = ap-southeast-1
output = table
INI
|
cat << INI | tee -a ${HOME}/.aws/credentials >/dev/null
[academia]
aws_access_key_id = AKIBVWTF7RISAULV8Q6Q
aws_secret_access_key = w2JVkDIE9zRTIP/S4m7Mm4cWKlFEYlzg1iGzfCnj
INI
|
cat << INI | tee -a ${HOME}/.aws/config >/dev/null
[profile academia]
region = ap-southeast-1
output = json
INI
|
| ||
export AWS_DEFAULT_PROFILE=academia
export AWS_PROFILE=academia
aws ec2 describe-vpcs
aws s3 ls
|
aws kms delete-alias --alias-name \ arn:aws:kms:ap-southeast-1:235216370500:alias/eks/sdlc_cluster cat ~/.aws/credentials cat ~/.aws/config |
aws configure --profile academia aws sts get-caller-identity aws configure list aws configure |
| ||
kubectl config set-context minikube --cluster=minikue
kubectl config set-context minikube
kubectl config get-contexts
kubectl config get-clusters
kubectl config view
|
References
| ||
| ||