AWS CLI で使い分けよう!S3の高レベルコマンドと API コマンドの違いと適切な選択方法
https://qiita.com/mkydk/items/fc1f524dcbc176bca1c9?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
【AWS】AWS CLI/AWS SDK/AWS CDKが利用できるDev Containers環境を作ると便利すぎて鼻血が出る
https://qiita.com/ymd65536/items/bf6279449861f49e564b?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
AWS 提供 Console-to-Code 功能
這個是在 Reddit 上看到的:「Convert AWS console actions to reusable code with AWS Console-to-Code, now generally available (aws.amazon.com)」,原文在「Convert AWS console actions to reusable code w
#AWS #Cloud #Computer #Murmuring #Network #Programming #Service #amazon #aws #awscli #cloud #code #console #gcp #google #platform #script #service #shell #to #web
Today I wasted about an hour attempting to fix a bug I had fixed once before. The lovely folks at #Microsoft decided to make #Powershell output files in the encoding UTF16 LE BOM. Very future-proof. Unfortunately, the excellent programmers at #AWS created their #awscli to read UTF8 sans BOM. If you forget about that difference, the AWS CLI will insist that you gave it invalid files to parse. And you can waste hours trying to figure out what's wrong. Remember to convert the encoding. #protip
Retrieve secrets from #AWS Secrets Manager by version #awscli
https://www.geekyhacker.com/retrieve-secrets-from-aws-secrets-manager-by-version/
pretty happy w/this shell oneliner to get the deets on the unique kms keys used in the last 100k decryptions
aws cloudtrail lookup-events --lookup-attributes "AttributeKey=EventName,AttributeValue=Decrypt" --region us-east-1 --max-results 100000 | jq -r '.Events[].CloudTrailEvent' | jq -r | grep '"ARN"' | sed 's!.*key/!!;s!"!!' | sort -u | xargs -n1 aws kms describe-key --key-id | grep -i 'keyid\|creation\|manager\|descr' | sed 's!.*"\(.*\)":!\1!;s!",!"!;s!KeyId!\n\nKeyId!'
#unix #shell #aws #awscli #bash #commandline #unixmagic #commandlineexcellence #oneliner #1liner
Various ways to restart an AWS EC2 instance
https://techdirectarchive.com/2023/04/30/various-ways-to-restart-an-aws-ec2-instance/
#AWS, #AWSAccessPoint, #AWSCLI, #AWSCLICommands, #AwsConfigure, #AWSConsole, #EC2, #EC2Instance, #EC2Instances, #EC2Launch
So, #AWS #cloudformation vs #AWSCLI. Looks to be ending up the same as Azure #ARM vs #AzureCLI. If you already have the template, and deploy it once, it is good. But developing CLI scripts is quicker (debug one step at a time, rather than all at once). And templates run into the same dead ends: e.g. decides it needs to recreate the entire subnet, so it attempts to, but runs into an IP address conflict with the existing one, and the whole thing stops. There are things/changes that declarative approaches just can't do, and you need to use migrations (CLI scripts).
How to Install Packages to Amazon VM using Terraform
#AmazonVirtualMachine, #AWS, #AWSCLI, #EC2Instances, #InstallPackagesToAmazonVirtualMachine, #InstallPackagesViaTerraform, #Packages, #StepsToDeployUsingTerraform, #Terraform
Add an EBS volume to AWS EC2 via the AWS Console and CLI
https://techdirectarchive.com/2022/04/22/adding-an-ebs-volume-to-aws-ec2/
#AddAnEBSVolumeToAWSEc2, #AddAnEBSVolumeToAWSEC2ViaTheAWSConsoleAndCLI, #AmazonEC2, #AWS, #AWSCLI, #AWSEBS, #AWSEC2, #CreatingAnEBSVolume, #CreatingAnEC2Instance, #EBSVolume, #EC2, #EC2Instance, #EC2Launch, #InstallingAWSCLIInLinux, #Volumes
Use the AWS CLI? Get powered up with custom aliases and subcommands, and bash command completion for your aliases.
https://gist.github.com/earchibald-lv/f2a165c832f1f455061af74cfa8127b4
I'm a few months late noticing, but I'm glad to see that the aws-cli has added the ability to display the current credentials, or credentials for a specific config profile.
aws configure export-credentials
Using options, the results can be formatted as environment variables for eval and use by other tools.
I think this is especially useful if the config profile assumes a (cross-account) role, or you are using `aws sso login`.
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/configure/export-credentials.html
Bonus:
Allow defaults for the parameter values in the config file, as in:
role_arn=arn:aws:iam::{{acct=123456789012}}:role/{{role=readonly}}
I want to be able to set up an aws-cli config profile that includes parameter substitutions, and then specify the values for those parameters with command line options.
The command line could be:
aws s3 ls \
--profile assumewithmfa \
--param acct=123456789012 \
--param role=s3-readonly
and the config:
[profile assumewithmfa]
source_profile=user-main
role_arn = arn:aws:iam::{{acct}}:role/{{role}}
mfa_serial=arn:aws:iam::987654321098:mfa/user
region=us-east-1