ever-just/agentskills/ec2-instance-connect-data-pull
Claude Code and agent skill by ever-just/agentskills
- community
Checking that the SKILL.md file is still in the repository.
Get a READ-ONLY shell on a production EC2 box with NO stored SSH key — using AWS EC2 Instance Connect plus an admin IAM principal — then extract MongoDB collections and container logs and bundle them back to your machine over SSH (tar + base64). Use when you need production data/logs for analysis but only have AWS credentials, not the server's private key.
Install
npx vskill@latest install ever-just/agentskills/ec2-instance-connect-data-pullSKILL.md
The same SKILL.md was published earlier as ever-just/agentskills/ec2-instance-connect-data-pull.
EC2 Instance Connect — Production Data Pull
Overview
You have AWS credentials but not the server's SSH key (it's a CI secret). EC2 Instance Connect lets an IAM principal push a 60-second ephemeral public key to an instance, so you can SSH in with a local keypair — no stored key needed. Once in, pull Mongo/logs and ship them home as a single base64 blob. Read-only, for analysis.
Prerequisites
- AWS CLI configured with a principal that has
ec2-instance-connect:SendSSHPublicKey(admin works). Check:aws sts get-caller-identity. - A local SSH keypair (
~/.ssh/id_ed25519[.pub]). ed25519 and RSA are both supported by Instance Connect. - The instance's region + AZ + id, and port 22 reachable from you.
- Explicit user authorization to access the production host. Confirm you're hitting the LIVE box (the IP in the docs is often stale):
dig +short <api-host>andcurl -s https://<api-host>/health.
Steps
OS user: Ubuntu AMIs → ubuntu, Amazon Linux → ec2-user. If SSH says "Please login as the user X", it tells you which.
Reusable helper (cassh.sh)
Push key + run a remote command (from $1 or stdin), so multi-step pulls don't fight the 60s window:
Pull Mongo (dockerized) as JSON-lines
For many collections, write each to a file on the server, then bundle once:
Generated assets behind a media proxy
Public media/ URLs often 302-redirect to a freshly-presigned S3 URL — fetch with redirects, from the server (it hosts them): curl -sL -o "$f" "https://<host>/public/media/$f". A 550-byte "file" is the redirect body — you forgot -L.
Pitfalls
- No SSM agent? Don't fight it — Instance Connect needs no agent. (
aws ssm describe-instance-informationempty = use Instance Connect.) - Key expires in 60s. Combine push+SSH in one shot (the helper re-pushes every call), or append your pubkey to
authorized_keysfor a long session (and remove it after). - macOS `base64` decodes with
-d -i <file>or-d < file, notbase64 -d file. - Harness safety classifier blocks SSH-to-prod until the user names the host, and intermittently blocks compound shell (pipes,
&&, reading a command from a file it can't see). Workarounds that keep working: pass remote scripts as an inline heredoc (the classifier can read it), keep local commands atomic (one operation each), and redirect big output to a file so it never floods your context. If a command is denied, simplify — don't try to evade the intent. - Stale infra docs. The README's server IP may be a decommissioned box. DNS + health-check the live host first; check the AWS-box
.envMONGO_URIto learn where the DB actually lives. - Read-only. Never run mutating commands on prod. Mongo
find/aggregation anddocker compose logsare safe; mask passwords when you echo connection strings.
Combining with other skills
production-agent-audit— what to do with the data once it's home.mongodb-schema-audit— once you have a Mongo shell.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ec2-instance-connect-data-pull/SKILL.md
Popularity
- Repository stars
- 3
- Repository forks
- 1
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ever-just/agentskills/ec2-instance-connect-data-pull)