mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(kb/awscli): add or improve command examples
This commit is contained in:
@@ -24,11 +24,28 @@ aws configure --profile 'work'
|
||||
export AWS_PROFILE='work'
|
||||
|
||||
|
||||
# Enable auto-prompt mode (like aws-shell).
|
||||
# Enable auto-prompt mode (like `aws-shell` does).
|
||||
aws configure set 'cli_auto_prompt' 'on-partial'
|
||||
export AWS_CLI_AUTO_PROMPT='on'
|
||||
|
||||
|
||||
# List applications in CodeDeploy.
|
||||
aws deploy list-applications
|
||||
|
||||
# List deployment groups defined for applications.
|
||||
aws deploy list-deployment-groups --application-name 'batman'
|
||||
|
||||
# Show details of deployment groups.
|
||||
aws deploy get-deployment-group --application-name 'batman' \
|
||||
--deployment-group-name 'production'
|
||||
|
||||
|
||||
|
||||
# Show RDS instances.
|
||||
aws rds describe-db-instances
|
||||
aws rds describe-db-instances --output 'json' --query "DBInstances[?(DBInstanceIdentifier=='master-prod')]"
|
||||
|
||||
|
||||
# List all SageMaker EndpointConfigurations' names.
|
||||
aws sagemaker list-endpoint-configs --output 'yaml-stream' | yq -r '.[].EndpointConfigs[].EndpointConfigName' -
|
||||
aws sagemaker list-endpoint-configs --output 'yaml-stream' --query 'EndpointConfigs[].EndpointConfigName' | yq -r '.[].[]' -
|
||||
@@ -49,6 +66,10 @@ aws secretsmanager describe-secret --secret-id 'ecr-pullthroughcache/docker-hub'
|
||||
aws secretsmanager get-secret-value --secret-id 'ecr-pullthroughcache/github'
|
||||
|
||||
|
||||
# List SNS queues (a.k.a. 'topics').
|
||||
aws sns list-topics
|
||||
|
||||
|
||||
# Start sessions via Session Manager.
|
||||
aws ssm start-session --target 'i-0123456789abcdef0'
|
||||
```
|
||||
|
||||
@@ -63,21 +63,6 @@ aws s3 sync '.' 's3://arn:aws:s3:us-west-2:123456789012:accesspoint/myaccesspoin
|
||||
# Delete buckets.
|
||||
aws s3 rb 's3://my-bucket'
|
||||
aws s3 rb 's3://my-bucket' --force
|
||||
|
||||
|
||||
# Lifecycle configurations.
|
||||
aws s3api get-bucket-lifecycle-configuration --bucket 'bucketName'
|
||||
aws s3api put-bucket-lifecycle-configuration --bucket 'bucketName' \
|
||||
--lifecycle-configuration 'file://lifecycle.definition.json'
|
||||
aws s3api delete-bucket-lifecycle-configuration --bucket 'bucketName'
|
||||
|
||||
|
||||
# Show tags on objects.
|
||||
aws s3api list-objects-v2 \
|
||||
--bucket 'my-bucket' --prefix 'someObjectsInHereAreTagged' \
|
||||
--query 'Contents[*].Key' --output text \
|
||||
| xargs -n 1 \
|
||||
aws s3api get-object-tagging --bucket 'my-bucket' --query 'TagSet[*]' --key
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -87,10 +72,29 @@ aws s3api list-objects-v2 \
|
||||
|
||||
```sh
|
||||
# Manage lifecycle configurations.
|
||||
aws s3 get-bucket-lifecycle-configuration --bucket 'batman'
|
||||
aws s3 put-bucket-lifecycle-configuration --bucket 'batman' \
|
||||
--lifecycle-configuration 'file://lifecycle-batman.json'
|
||||
aws s3 delete-bucket-lifecycle --bucket 'batman'
|
||||
# Operations on lifecycle rules take a while.
|
||||
aws s3api get-bucket-lifecycle-configuration --bucket 'bucketName'
|
||||
aws s3api put-bucket-lifecycle-configuration --bucket 'bucketName' \
|
||||
--lifecycle-configuration 'file://lifecycle.definition.json'
|
||||
aws s3api delete-bucket-lifecycle-configuration --bucket 'bucketName'
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Real life use cases</summary>
|
||||
|
||||
```sh
|
||||
# Get objects with their storage class.
|
||||
aws s3api list-objects --bucket 'my-bucket' \
|
||||
--query 'Contents[].{Key: Key, StorageClass: StorageClass}'
|
||||
|
||||
# Show tags on objects.
|
||||
aws s3api list-objects-v2 \
|
||||
--bucket 'my-bucket' --prefix 'someObjectsInHereAreTagged' \
|
||||
--query 'Contents[*].Key' --output text \
|
||||
| xargs -n 1 \
|
||||
aws s3api get-object-tagging --bucket 'my-bucket' --query 'TagSet[*]' --key
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user