@icarusmx/creta 1.5.12 → 1.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/creta.js +30 -1
- package/lib/data/command-help/aws-ec2.js +34 -0
- package/lib/data/command-help/grep.js +72 -0
- package/lib/data/command-help/index.js +9 -1
- package/lib/executors/CommandHelpExecutor.js +6 -1
- package/lib/exercises/.claude/settings.local.json +12 -0
- package/lib/exercises/01-developing-muscle-for-nvim.md +528 -0
- package/lib/exercises/{iterm2-pane-navigation.md → 02-iterm2-pane-navigation.md} +1 -1
- package/lib/exercises/05-svelte-first-steps.md +1340 -0
- package/lib/exercises/{curl-and-pipes.md → 06-curl-and-pipes.md} +187 -72
- package/lib/exercises/07-claude-api-first-steps.md +855 -0
- package/lib/exercises/08-playwright-svelte-guide.md +1384 -0
- package/lib/exercises/09-docker-first-steps.md +1475 -0
- package/lib/exercises/{railway-deployment.md → 10-railway-deployment.md} +1 -0
- package/lib/exercises/{aws-billing-detective.md → 11-aws-billing-detective.md} +215 -35
- package/lib/exercises/12-install-skills.md +755 -0
- package/lib/exercises/README.md +180 -0
- package/lib/exercises/utils/booklet-2up.js +133 -0
- package/lib/exercises/utils/booklet-manual-duplex.js +159 -0
- package/lib/exercises/utils/booklet-simple.js +136 -0
- package/lib/exercises/utils/create-booklet.js +116 -0
- package/lib/scripts/aws-ec2-all.sh +58 -0
- package/package.json +3 -2
- /package/lib/exercises/{git-stash-workflow.md → 03-git-stash-workflow.md} +0 -0
- /package/lib/exercises/{array-object-manipulation.md → 04-array-object-manipulation.md} +0 -0
|
@@ -68,6 +68,7 @@ scoop install railway
|
|
|
68
68
|
|
|
69
69
|
**LazyVim Tip:** Open a floating terminal to run commands while reading:
|
|
70
70
|
- `<leader>ft` - Open floating terminal
|
|
71
|
+
#TODO change the comand below to press twice esc really fast and then c-w w
|
|
71
72
|
- `<C-\><C-n>` - Exit terminal insert mode (go to Normal mode)
|
|
72
73
|
- `<C-w>w` - Cycle between terminal and guide
|
|
73
74
|
- `i` - Back to terminal insert mode (type commands)
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# AWS Billing Detective Guide 🕵️
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- vim: set foldmethod=marker foldlevel=0: -->
|
|
4
|
+
|
|
5
|
+
## 📖 LazyVim Reading Guide {{{
|
|
6
|
+
|
|
7
|
+
**Start with:** `zM` (close all folds) → Navigate with `za` (toggle fold under cursor)
|
|
8
|
+
|
|
9
|
+
This document uses fold markers `{{{` and `}}}` for organized reading.
|
|
10
|
+
|
|
11
|
+
}}}
|
|
12
|
+
|
|
13
|
+
## The Mystery: "I turned everything off but AWS still charges me" {{{
|
|
4
14
|
|
|
5
15
|
Common culprits (in order of likelihood):
|
|
6
16
|
1. **EBS Volumes** (orphaned disks after stopping EC2)
|
|
@@ -13,16 +23,31 @@ Common culprits (in order of likelihood):
|
|
|
13
23
|
8. **CloudWatch logs** (accumulating logs)
|
|
14
24
|
9. **Data transfer** (cross-region/out-to-internet)
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
}}}
|
|
27
|
+
|
|
28
|
+
## What You'll Learn {{{
|
|
29
|
+
|
|
30
|
+
This guide teaches you to:
|
|
31
|
+
1. **Set up AWS CLI** - Get programmatic access to AWS
|
|
32
|
+
2. **Hunt down hidden costs** - Find resources charging you across all regions
|
|
33
|
+
3. **Clean up efficiently** - Delete or stop resources via command line
|
|
34
|
+
4. **Prevent future surprises** - Set up billing alerts and best practices
|
|
35
|
+
5. **Use powerful bash scripts** - Audit all regions automatically
|
|
36
|
+
|
|
37
|
+
**Time needed:** 30-60 minutes (depending on how many resources you have)
|
|
38
|
+
|
|
39
|
+
**Prerequisites:** Basic terminal skills, an AWS account
|
|
17
40
|
|
|
18
|
-
|
|
41
|
+
}}}
|
|
42
|
+
|
|
43
|
+
## Part 1: Get Your AWS Access Keys {{{
|
|
19
44
|
|
|
20
45
|
### Step 1: Navigate to IAM Console
|
|
21
46
|
1. Log into AWS Console: https://console.aws.amazon.com
|
|
22
47
|
2. Search for "IAM" in top search bar
|
|
23
48
|
3. Click **IAM** (Identity and Access Management)
|
|
24
49
|
|
|
25
|
-
### Step
|
|
50
|
+
### Step 2A: Create Access Keys (If Using IAM User - Recommended)
|
|
26
51
|
1. In left sidebar → Click **Users**
|
|
27
52
|
2. Click your username
|
|
28
53
|
3. Click **Security credentials** tab
|
|
@@ -36,15 +61,96 @@ Common culprits (in order of likelihood):
|
|
|
36
61
|
- Secret access key (like `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`)
|
|
37
62
|
- **You can't see the secret again!**
|
|
38
63
|
|
|
39
|
-
### Step
|
|
64
|
+
### Step 2B: Create Access Keys (If Using Root Account - ⚠️ Not Recommended)
|
|
65
|
+
|
|
66
|
+
**🚨 Security Warning:** Using root account access keys is dangerous. Root has unlimited permissions.
|
|
67
|
+
|
|
68
|
+
**Why this is risky:**
|
|
69
|
+
- Root account can delete EVERYTHING in your AWS account
|
|
70
|
+
- If keys leak, attackers have complete control
|
|
71
|
+
- No way to limit permissions
|
|
72
|
+
|
|
73
|
+
**Better approach:** Create an IAM user with `AdministratorAccess` or `PowerUserAccess` policy instead (use Step 2A).
|
|
74
|
+
|
|
75
|
+
**If you must use root (not recommended):**
|
|
76
|
+
|
|
77
|
+
1. Click your **account name** in top-right corner
|
|
78
|
+
2. Select **Security credentials** from dropdown menu
|
|
79
|
+
3. Scroll down to **Access keys** section
|
|
80
|
+
4. Click **Create access key**
|
|
81
|
+
5. Select use case: **"Command Line Interface (CLI)"**
|
|
82
|
+
6. Check acknowledgment box
|
|
83
|
+
7. Click **Next** → **Create access key**
|
|
84
|
+
8. **IMPORTANT:** Download `.csv` or copy both:
|
|
85
|
+
- Access key ID (like `AKIAIOSFODNN7EXAMPLE`)
|
|
86
|
+
- Secret access key (like `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`)
|
|
87
|
+
- **You can't see the secret again!**
|
|
88
|
+
|
|
89
|
+
**⚠️ DELETE these root keys after creating an IAM user!**
|
|
90
|
+
|
|
91
|
+
### Step 3: Storing Your Credentials Securely
|
|
92
|
+
|
|
93
|
+
#### Option A: Manual Credentials File (For now - before AWS CLI install)
|
|
94
|
+
Since we haven't installed AWS CLI yet, you can create the credentials file manually:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Create AWS config directory
|
|
98
|
+
mkdir -p ~/.aws
|
|
99
|
+
|
|
100
|
+
# Create credentials file manually
|
|
101
|
+
cat > ~/.aws/credentials << 'EOF'
|
|
102
|
+
[default]
|
|
103
|
+
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
|
|
104
|
+
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
105
|
+
EOF
|
|
106
|
+
|
|
107
|
+
# Create config file manually
|
|
108
|
+
cat > ~/.aws/config << 'EOF'
|
|
109
|
+
[default]
|
|
110
|
+
region = eu-west-1
|
|
111
|
+
output = json
|
|
112
|
+
EOF
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Replace the example keys with your actual keys from Step 2.
|
|
116
|
+
|
|
117
|
+
#### Option B: Project Environment Files (For app development)
|
|
118
|
+
If you're building an application that needs AWS access, store credentials in `.env.local`:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Create .env.local file in your project root
|
|
122
|
+
echo "AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE" >> .env.local
|
|
123
|
+
echo "AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" >> .env.local
|
|
124
|
+
echo "AWS_REGION=eu-west-1" >> .env.local
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**⚠️ CRITICAL: Add to .gitignore immediately!**
|
|
128
|
+
```bash
|
|
129
|
+
# Prevent committing secrets to git
|
|
130
|
+
echo ".env.local" >> .gitignore
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Your `.env.local` should look like:
|
|
134
|
+
```
|
|
135
|
+
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
|
|
136
|
+
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
137
|
+
AWS_REGION=eu-west-1
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**When to use each:**
|
|
141
|
+
- `.env.local`: Building Node.js apps, scripts, or projects that need AWS SDK
|
|
142
|
+
- `~/.aws/credentials`: Using AWS CLI commands directly in terminal (we'll set this up properly in Part 2)
|
|
143
|
+
|
|
144
|
+
#### Option C: Use Existing Keys
|
|
40
145
|
If you already created keys before:
|
|
41
146
|
- Check your `~/.aws/credentials` file
|
|
147
|
+
- Check your project's `.env.local` file
|
|
42
148
|
- Or retrieve from password manager
|
|
43
149
|
- **Never share these or commit to git**
|
|
44
150
|
|
|
45
|
-
|
|
151
|
+
}}}
|
|
46
152
|
|
|
47
|
-
## Part 2: Install & Configure AWS CLI
|
|
153
|
+
## Part 2: Install & Configure AWS CLI {{{
|
|
48
154
|
|
|
49
155
|
### Install AWS CLI
|
|
50
156
|
|
|
@@ -65,6 +171,8 @@ Download installer from: https://aws.amazon.com/cli/
|
|
|
65
171
|
|
|
66
172
|
### Configure AWS CLI
|
|
67
173
|
|
|
174
|
+
**If you already created credentials manually in Step 3, `aws configure` will update those files.**
|
|
175
|
+
|
|
68
176
|
```bash
|
|
69
177
|
aws configure
|
|
70
178
|
```
|
|
@@ -73,25 +181,52 @@ You'll be prompted:
|
|
|
73
181
|
```
|
|
74
182
|
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
|
|
75
183
|
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
76
|
-
Default region name [None]:
|
|
184
|
+
Default region name [None]: eu-west-1
|
|
77
185
|
Default output format [None]: json
|
|
78
186
|
```
|
|
79
187
|
|
|
188
|
+
**Recommended regions (especially for crypto/Binance API compatibility):**
|
|
189
|
+
- `eu-west-1` (Ireland) - Europe, reliable, crypto-friendly
|
|
190
|
+
- `eu-central-1` (Frankfurt) - Europe, low latency
|
|
191
|
+
- `eu-north-1` (Stockholm) - Europe, newer, often cheaper
|
|
192
|
+
- `us-east-1` (N. Virginia) - Most common, but some APIs geo-restrict US
|
|
193
|
+
- `ap-southeast-1` (Singapore) - Asia-Pacific, good for global access
|
|
194
|
+
|
|
195
|
+
**⚠️ Avoid for crypto development:**
|
|
196
|
+
- Regions in countries with strict crypto regulations (some US regions may be restricted by exchanges)
|
|
197
|
+
- European regions are generally safer for Binance and other exchange APIs
|
|
198
|
+
|
|
80
199
|
**Configuration is saved to:**
|
|
81
200
|
- `~/.aws/credentials` (keys)
|
|
82
201
|
- `~/.aws/config` (region/settings)
|
|
83
202
|
|
|
84
203
|
### Verify Setup
|
|
85
204
|
|
|
205
|
+
Test that AWS CLI is properly configured:
|
|
206
|
+
|
|
86
207
|
```bash
|
|
87
208
|
aws sts get-caller-identity
|
|
88
209
|
```
|
|
89
210
|
|
|
90
|
-
|
|
211
|
+
**Expected output:**
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"UserId": "AIDAI...",
|
|
215
|
+
"Account": "123456789012",
|
|
216
|
+
"Arn": "arn:aws:iam::123456789012:user/your-username"
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**If you see an error:**
|
|
221
|
+
- `Unable to locate credentials` → Re-run `aws configure`
|
|
222
|
+
- `Invalid security token` → Check your access keys are correct
|
|
223
|
+
- `Access Denied` → IAM user might need permissions
|
|
91
224
|
|
|
92
|
-
|
|
225
|
+
✅ **Success!** You're now ready to hunt for AWS charges.
|
|
93
226
|
|
|
94
|
-
|
|
227
|
+
}}}
|
|
228
|
+
|
|
229
|
+
## Part 3: The AWS Billing Audit {{{
|
|
95
230
|
|
|
96
231
|
### 🔍 Step 1: Check Which Regions You're Using
|
|
97
232
|
|
|
@@ -115,7 +250,7 @@ done
|
|
|
115
250
|
|
|
116
251
|
### 🔍 Step 2: Hunt for EC2 Charges
|
|
117
252
|
|
|
118
|
-
#### List ALL EC2 Instances (all states)
|
|
253
|
+
#### List ALL EC2 Instances (all states, all regions)
|
|
119
254
|
|
|
120
255
|
```bash
|
|
121
256
|
# Check default region
|
|
@@ -128,6 +263,14 @@ aws ec2 describe-instances --region us-east-1 --output table
|
|
|
128
263
|
aws ec2 describe-instances \
|
|
129
264
|
--query 'Reservations[].Instances[].[InstanceId,State.Name,InstanceType]' \
|
|
130
265
|
--output table
|
|
266
|
+
|
|
267
|
+
# Check ALL regions (recommended - instances hide in forgotten regions!)
|
|
268
|
+
for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do
|
|
269
|
+
echo "Checking region: $region"
|
|
270
|
+
aws ec2 describe-instances --region $region \
|
|
271
|
+
--query 'Reservations[].Instances[].[InstanceId,State.Name,InstanceType]' \
|
|
272
|
+
--output table 2>/dev/null | grep -v "^$"
|
|
273
|
+
done
|
|
131
274
|
```
|
|
132
275
|
|
|
133
276
|
#### Stop Running Instances
|
|
@@ -383,9 +526,9 @@ aws logs describe-log-groups \
|
|
|
383
526
|
aws logs delete-log-group --log-group-name /aws/lambda/my-function
|
|
384
527
|
```
|
|
385
528
|
|
|
386
|
-
|
|
529
|
+
}}}
|
|
387
530
|
|
|
388
|
-
## Part 4: The Nuclear Option - Check Everything
|
|
531
|
+
## Part 4: The Nuclear Option - Check Everything {{{
|
|
389
532
|
|
|
390
533
|
### All-Regions Audit Script
|
|
391
534
|
|
|
@@ -447,9 +590,9 @@ chmod +x aws-audit-all-regions.sh
|
|
|
447
590
|
./aws-audit-all-regions.sh
|
|
448
591
|
```
|
|
449
592
|
|
|
450
|
-
|
|
593
|
+
}}}
|
|
451
594
|
|
|
452
|
-
## Part 5: Use AWS Cost Explorer (Web UI)
|
|
595
|
+
## Part 5: Use AWS Cost Explorer (Web UI) {{{
|
|
453
596
|
|
|
454
597
|
1. Go to: https://console.aws.amazon.com/cost-management/home
|
|
455
598
|
2. Click **Cost Explorer** → **Enable Cost Explorer** (if first time)
|
|
@@ -466,9 +609,9 @@ chmod +x aws-audit-all-regions.sh
|
|
|
466
609
|
- S3
|
|
467
610
|
- Data Transfer
|
|
468
611
|
|
|
469
|
-
|
|
612
|
+
}}}
|
|
470
613
|
|
|
471
|
-
## Part 6: Set Up Billing Alerts
|
|
614
|
+
## Part 6: Set Up Billing Alerts {{{
|
|
472
615
|
|
|
473
616
|
**Prevent this from happening again:**
|
|
474
617
|
|
|
@@ -492,9 +635,9 @@ aws cloudwatch put-metric-alarm \
|
|
|
492
635
|
3. Set threshold (e.g., $10/month)
|
|
493
636
|
4. Add email alert
|
|
494
637
|
|
|
495
|
-
|
|
638
|
+
}}}
|
|
496
639
|
|
|
497
|
-
## Quick Reference: Most Common Commands
|
|
640
|
+
## Quick Reference: Most Common Commands {{{
|
|
498
641
|
|
|
499
642
|
```bash
|
|
500
643
|
# Check identity
|
|
@@ -525,9 +668,9 @@ for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output
|
|
|
525
668
|
done
|
|
526
669
|
```
|
|
527
670
|
|
|
528
|
-
|
|
671
|
+
}}}
|
|
529
672
|
|
|
530
|
-
## Troubleshooting
|
|
673
|
+
## Troubleshooting {{{
|
|
531
674
|
|
|
532
675
|
### "Unable to locate credentials"
|
|
533
676
|
```bash
|
|
@@ -556,26 +699,63 @@ aws configure set region us-east-1
|
|
|
556
699
|
5. **Check CloudFront** - distributions can accumulate charges
|
|
557
700
|
6. **Contact AWS Support** - they can help identify charges
|
|
558
701
|
|
|
559
|
-
|
|
702
|
+
}}}
|
|
560
703
|
|
|
561
|
-
## Prevention Checklist
|
|
704
|
+
## Prevention Checklist {{{
|
|
562
705
|
|
|
563
|
-
Before
|
|
706
|
+
### Before Leaving AWS For The Day:
|
|
707
|
+
|
|
708
|
+
Quick commands to prevent charges:
|
|
709
|
+
|
|
710
|
+
```bash
|
|
711
|
+
# 1. List all running EC2 instances
|
|
712
|
+
aws ec2 describe-instances \
|
|
713
|
+
--query 'Reservations[].Instances[?State.Name==`running`].[InstanceId,InstanceType]' \
|
|
714
|
+
--output table
|
|
715
|
+
|
|
716
|
+
# 2. Check for orphaned EBS volumes
|
|
717
|
+
aws ec2 describe-volumes \
|
|
718
|
+
--filters "Name=status,Values=available" \
|
|
719
|
+
--query 'Volumes[].[VolumeId,Size]' \
|
|
720
|
+
--output table
|
|
721
|
+
|
|
722
|
+
# 3. Check for unused Elastic IPs
|
|
723
|
+
aws ec2 describe-addresses \
|
|
724
|
+
--query 'Addresses[?AssociationId==null].[PublicIp]' \
|
|
725
|
+
--output table
|
|
726
|
+
|
|
727
|
+
# 4. Check for NAT Gateways
|
|
728
|
+
aws ec2 describe-nat-gateways \
|
|
729
|
+
--filter "Name=state,Values=available" \
|
|
730
|
+
--output table
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### Checklist:
|
|
564
734
|
|
|
565
735
|
- [ ] Stop or terminate ALL EC2 instances
|
|
566
|
-
- [ ] Delete ALL unattached EBS volumes
|
|
736
|
+
- [ ] Delete ALL unattached EBS volumes (the #1 hidden cost!)
|
|
567
737
|
- [ ] Release ALL unused Elastic IPs
|
|
568
|
-
- [ ] Delete NAT Gateways if not needed
|
|
569
|
-
- [ ]
|
|
570
|
-
- [ ] Check ALL regions (not just default)
|
|
571
|
-
- [ ] Set up billing alerts
|
|
572
|
-
- [ ]
|
|
738
|
+
- [ ] Delete NAT Gateways if not needed ($32/month each!)
|
|
739
|
+
- [ ] Stop or delete RDS instances
|
|
740
|
+
- [ ] Check ALL regions (not just your default)
|
|
741
|
+
- [ ] Set up billing alerts (do this ONCE)
|
|
742
|
+
- [ ] Review AWS Free Tier Dashboard monthly
|
|
743
|
+
|
|
744
|
+
### Golden Rule:
|
|
745
|
+
|
|
746
|
+
**If you're not actively using AWS, your monthly bill should be $0-2.**
|
|
747
|
+
|
|
748
|
+
Anything above that means:
|
|
749
|
+
- You have running resources you forgot about
|
|
750
|
+
- EBS volumes are accumulating
|
|
751
|
+
- Elastic IPs aren't released
|
|
752
|
+
- NAT Gateway is still running
|
|
573
753
|
|
|
574
|
-
**
|
|
754
|
+
**Run the audit script from Part 4 weekly to stay safe!**
|
|
575
755
|
|
|
576
|
-
|
|
756
|
+
}}}
|
|
577
757
|
|
|
578
|
-
## Useful Links
|
|
758
|
+
## Useful Links {{{
|
|
579
759
|
|
|
580
760
|
- AWS Cost Explorer: https://console.aws.amazon.com/cost-management/home
|
|
581
761
|
- AWS Free Tier: https://console.aws.amazon.com/billing/home#/freetier
|
|
@@ -583,6 +763,6 @@ Before leaving AWS for the day:
|
|
|
583
763
|
- IAM Console: https://console.aws.amazon.com/iam
|
|
584
764
|
- Support Center: https://console.aws.amazon.com/support/home
|
|
585
765
|
|
|
586
|
-
|
|
766
|
+
}}}
|
|
587
767
|
|
|
588
768
|
**Good luck, detective! 🕵️**
|