{"id":19052325,"url":"https://github.com/phuurl/ec2-mac-releaser","last_synced_at":"2026-05-13T23:34:55.226Z","repository":{"id":159544514,"uuid":"522047750","full_name":"Phuurl/ec2-mac-releaser","owner":"Phuurl","description":"Automation to release EC2 Macs after their minimum 24 hour period.","archived":false,"fork":false,"pushed_at":"2023-12-18T19:14:34.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T03:35:48.426Z","etag":null,"topics":["aws","aws-sam","ec2","ec2-mac","mac","step-functions"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Phuurl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-06T20:31:28.000Z","updated_at":"2024-06-06T09:21:51.000Z","dependencies_parsed_at":"2024-11-08T23:25:34.131Z","dependency_job_id":"b3904348-dad8-43a6-a577-07a2e0cb9022","html_url":"https://github.com/Phuurl/ec2-mac-releaser","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Phuurl/ec2-mac-releaser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phuurl%2Fec2-mac-releaser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phuurl%2Fec2-mac-releaser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phuurl%2Fec2-mac-releaser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phuurl%2Fec2-mac-releaser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Phuurl","download_url":"https://codeload.github.com/Phuurl/ec2-mac-releaser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phuurl%2Fec2-mac-releaser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33004388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-sam","ec2","ec2-mac","mac","step-functions"],"created_at":"2024-11-08T23:21:55.520Z","updated_at":"2026-05-13T23:34:55.191Z","avatar_url":"https://github.com/Phuurl.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ec2-mac-releaser\nAutomation to release EC2 Mac dedicated hosts after their [minimum 24 hour period](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-mac-instances.html#mac-instance-release-dedicated-host).\n\nThis stack comprises of a Step Function, and associated EventBridge trigger rule to allow automatic invocation whenever a new `mac1` or `mac2` dedicated host is provisioned.\n\nHigh level Step Function flow:\n```mermaid\nstateDiagram-v2\n    waitSecondsCheck: Check for waitSeconds input\n    setDefaultWait: Set 24hr default value\n    preserveTagCheck: Check for 'preserve' tag on host\n    instanceTerminateCheck: Check if 'terminateInstances' is true in input\n    state if_waitSeconds \u003c\u003cchoice\u003e\u003e\n    state if_preserveTag \u003c\u003cchoice\u003e\u003e\n    state if_terminateInstances \u003c\u003cchoice\u003e\u003e\n    [*] --\u003e waitSecondsCheck\n    waitSecondsCheck --\u003e if_waitSeconds\n    if_waitSeconds --\u003e Wait: waitSeconds input present\n    if_waitSeconds --\u003e setDefaultWait : waitSeconds not specified\n    setDefaultWait --\u003e Wait\n    Wait --\u003e DescribeHosts\n    DescribeHosts --\u003e preserveTagCheck\n    preserveTagCheck --\u003e if_preserveTag\n    if_preserveTag --\u003e [*]: 'preserve' tag present - skip\n    if_preserveTag --\u003e instanceTerminateCheck: No 'preserve' tag - continue\n    instanceTerminateCheck --\u003e if_terminateInstances\n    if_terminateInstances --\u003e TerminateInstances: 'terminateInstances' == true\n    if_terminateInstances --\u003e ReleaseHosts: 'terminateInstances' == false or not specified\n    TerminateInstances --\u003e ReleaseHosts\n    ReleaseHosts --\u003e [*]\n```\n\n## Usage\nThis stack uses [SAM](https://aws.amazon.com/serverless/sam/) - once you have that setup, you can then build and deploy with\n```bash\nsam build\nsam deploy --guided\n```\n\nOnce deployed, the Step Function will automatically trigger and begin its 24 hour countdown whenever any new `mac1.metal` or `mac2.metal` dedicated hosts are created in that region.\n\nIf you want to opt out a new host from being automatically released, you can tag it with the key `preserve` (value doesn't matter), and this will cause it to be ignored when the Step Function executes.\n\n### Manual invocation\nYou can also execute the Step Function manually. At a minimum it requires the target dedicated host ID - this will cause it to use the default 24 hour wait duration:\n```json\n{\n  \"targetHosts\": [\n    \"the target dedicated host ID - will start with h-\"\n  ]\n}\n```\n\nYou can also override the default wait duration with a custom value (in seconds), as well as specifying whether to terminate instances on the dedicated host (`false` by default):\n```json\n{\n  \"targetHosts\": [\n    \"the target dedicated host ID - will start with h-\"\n  ],\n  \"waitSeconds\": 60,\n  \"terminateInstances\": true\n}\n```\n\n## Caveats\nAs with releasing any other types of dedicated hosts, the call will fail if there are any instances running on them at the time. By default, this Step Function does not attempt to release any instances running on the target dedicated host, and instead marks the execution as failed.\n\nThis can be overridden by setting the `TerminateInstances` CloudFormation parameter to `\"true\"` in stack deployment, or for manual executions specifying `\"terminateInstances\": true` in the event.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphuurl%2Fec2-mac-releaser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphuurl%2Fec2-mac-releaser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphuurl%2Fec2-mac-releaser/lists"}