eolas/neuron/0c4abb9b-c940-4636-84e0-b880b7c1ac8b/AWS_CLI.md
2025-01-02 18:02:35 +00:00

69 lines
932 B
Markdown

---
tags:
- AWS
- procedural
---
# AWS CLI frequent commands
### Retrieve current user
```
aws-sts get-caller-identity
```
### List users
```
aws configure list
aws configure list-profiles
```
### View profile data
```
vim ./aws/credentials
```
## CloudFormation
### List stacks
```
aws cloudformation --list-stacks
```
### Delete a stack
```
aws cloudformation delete-stack --stack-name <my_stack> --region <region>
```
`region` is optional especially if only deployed to one region
## Billing ("Cost explorer")
### Usage for month
```
aws ce get-cost-and-usage --time-period Start=$(date +%Y-%m-01),End=$(date -d @$(( $(date +%s) + 86400 )) +%Y-%m-%d) --granularity MONTHLY --metrics "UnblendedCost" "UsageQuantity
```
### Retrieve current user
```
aws-sts get-caller-identity
```
### List users
```
aws configure list
aws configure list-profiles
```
### View profile data
```
vim ./aws/credentials
```