Skip to main content

Lightweight Python library with AWS and other general purpose classes.

Project description

https://img.shields.io/pypi/v/infrahouse_core.svg Documentation Status

Lightweight Python library with AWS and other general purpose classes.

Installation

pip install infrahouse-core

Features

AWS Classes

  • EC2Instance - Manage EC2 instances with SSM command execution support

  • ASG - AutoScaling Group lifecycle management (instance refresh, lifecycle hooks)

  • DynamoDBTable - DynamoDB operations with distributed locking support

  • Route53 Zone - DNS record management (add/delete A records)

  • AWS Session Management - SSO login, role assumption, credential handling

GitHub Integration

  • GitHubActions - Manage self-hosted GitHub Actions runners

  • GitHubActionsRunner - Query runner status, labels, and metadata

  • Token generation from GitHub App credentials stored in AWS Secrets Manager

Usage Examples

EC2 Instance with SSM Command Execution

from infrahouse_core.aws.ec2_instance import EC2Instance

# Connect to an instance (optionally assume a role for cross-account access)
instance = EC2Instance(
    instance_id="i-0123456789abcdef0",
    region="us-east-1",
    role_arn="arn:aws:iam::123456789012:role/MyRole"  # optional
)

# Execute a command via SSM
exit_code, stdout, stderr = instance.execute_command("hostname")

# Access instance properties
print(instance.private_ip)
print(instance.hostname)
print(instance.tags)

DynamoDB Distributed Lock

from infrahouse_core.aws.dynamodb import DynamoDBTable

table = DynamoDBTable("my-lock-table", region="us-east-1")

with table.lock("my-resource", timeout=30):
    # Critical section - only one process can hold this lock
    do_exclusive_work()

Route53 DNS Management

from infrahouse_core.aws.route53.zone import Zone

zone = Zone(zone_name="example.com")

# Add an A record
zone.add_record("myhost", "10.0.0.1", ttl=300)

# Delete an A record
zone.delete_record("myhost", "10.0.0.1")

GitHub Actions Runner Management

from infrahouse_core.github import GitHubActions, GitHubAuth

github = GitHubAuth(token="ghp_...", org="my-org")
actions = GitHubActions(github)

# List all runners
for runner in actions.runners:
    print(f"{runner.name}: {runner.status}")

# Find runners by label
runners = actions.find_runners_by_label("self-hosted")

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infrahouse_core-0.18.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infrahouse_core-0.18.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file infrahouse_core-0.18.0.tar.gz.

File metadata

  • Download URL: infrahouse_core-0.18.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.9

File hashes

Hashes for infrahouse_core-0.18.0.tar.gz
Algorithm Hash digest
SHA256 81cba825a5e84a58db888c19e070419fe984421eb92d8606f5cd06a9a538cb25
MD5 6bb6701c154a630b8fca2c858ba44f60
BLAKE2b-256 ce73433ee9bb68052b1575f0b45917347616e3ba799cc4bdc8ecca5583a268c3

See more details on using hashes here.

File details

Details for the file infrahouse_core-0.18.0-py3-none-any.whl.

File metadata

File hashes

Hashes for infrahouse_core-0.18.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1eedff3add4c4c8c15476b3cbb822b9b581dc7748af4c7ef2c72a6f9a771bced
MD5 8a5c5ccb064286b932ff946d28159f1c
BLAKE2b-256 01d34e45446e59b3bff682a0f25b741e4693e146139cd5a643e7d893d6387fb7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page