Skip to main content

AWS EC2 operations

v0.1.12

EC2 instance inventory + state introspection plus narrow mutators (stop, start, reboot, terminate). Auth via AWS_PROFILE + AWS_REGION on the runner host.

7 allowed by default 3 need approval by default 1 denied by default
Pack ID
aws-ec2
Vendor
emisar
OS
linux
Actions
11
Required binaries. Install these on the host before relying on the pack — an action that calls a missing one fails at run time.
aws

Install

emisar pack install fetches this pack, re-validates it, and verifies its content hash against the --hash below — the exact bytes this page was rendered against, so a tampered copy is rejected — before copying it into the runner's packs dir. The command reloads a running daemon itself; no manual restart.

on the runner host
sudo emisar pack install aws-ec2 --hash sha256:c32ffbe47028e40312445ed9daf752411a10a8c4424d1d94573e3aaa8300f1c3

Setup

Drives the aws CLI on the runner host. It resolves credentials and region from its own environment or ~/.aws config — the runner only forwards the variables you allowlist in inherit_env .

Environment

Set these on the runner host, then add each name to execution.inherit_env so the value reaches the action.

  • AWS_PROFILE

    Named profile in ~/.aws/config and ~/.aws/credentials . Omit to use the default profile or static-key/instance-role auth.

  • AWS_REGION required

    Region to operate in; EC2 is regional, so calls fail without it.

  • AWS_ACCESS_KEY_ID

    Static access key. Use instead of a profile; pair with AWS_SECRET_ACCESS_KEY .

  • AWS_SECRET_ACCESS_KEY

    Secret for AWS_ACCESS_KEY_ID .

  • AWS_SESSION_TOKEN

    Session token for temporary (STS) credentials.

Notes

  • An EC2 instance role or ECS task role needs no key at all and is the shape to prefer; a static pair is minted from the IAM users console → the user → Security credentials → Create access key.
  • Alternative to env keys: an ~/.aws/credentials profile (read from disk, no inherit_env entry) or, on EC2/ECS, the instance/task role from instance metadata (no credentials needed at all).
  • Inventory needs ec2:Describe* (read-only). The mutators stop_instance / start_instance / reboot_instance / terminate_instance additionally need ec2:StopInstances / StartInstances / RebootInstances / TerminateInstances.

Verify it works

Runs ec2.describe_instances, a low-risk read that confirms the pack can reach its target. Run it on the host once the pack is installed; pack install runs it for you.

on the runner host
sudo emisar pack verify aws-ec2

Install and configure a pack walks through the whole sequence on a host.

Actions 11 total

View on GitHub
  • ec2.console_output exec medium Medium — changes state, easily reversible

    aws ec2 get-console-output

    Get serial console output for one instance. Boot logs can contain application-written sensitive data, so restrict this action by policy. Useful for boot diagnostics.

    View source on GitHub
  • ec2.describe_instance_one exec low Low — read-only or trivially reversible

    aws ec2 describe-instances --instance-ids

    Get details for one EC2 instance.

    View source on GitHub
  • ec2.describe_instances exec low Low — read-only or trivially reversible

    aws ec2 describe-instances

    List all EC2 instances in the configured region with state + tags + IPs.

    View source on GitHub
  • ec2.describe_security_groups exec low Low — read-only or trivially reversible

    aws ec2 describe-security-groups

    List all SGs with ingress/egress rules.

    View source on GitHub
  • ec2.describe_subnets exec low Low — read-only or trivially reversible

    aws ec2 describe-subnets

    List all subnets in this region.

    View source on GitHub
  • ec2.describe_volumes exec low Low — read-only or trivially reversible

    aws ec2 describe-volumes

    List all EBS volumes with size + state + attachment.

    View source on GitHub
  • ec2.instance_status exec low Low — read-only or trivially reversible

    aws ec2 describe-instance-status

    Show per-instance system + instance status checks.

    View source on GitHub
  • ec2.reboot_instance exec high High — service-affecting

    aws ec2 reboot-instances

    Reboot one instance. Instance keeps its IPs + ephemeral storage.

    View source on GitHub
  • ec2.start_instance exec high High — service-affecting

    aws ec2 start-instances

    Start one stopped instance.

    View source on GitHub
  • ec2.stop_instance exec high High — service-affecting

    aws ec2 stop-instances

    Stop one instance. Public IP is released (use Elastic IP to retain).

    View source on GitHub
  • ec2.terminate_instance exec critical Critical — data loss or irreversible

    aws ec2 terminate-instances

    Terminate one instance permanently, destroying its ephemeral storage. Cannot be undone.

    View source on GitHub