{"id":19610065,"url":"https://github.com/nfultz/pumpkin","last_synced_at":"2025-04-27T21:31:20.311Z","repository":{"id":72194384,"uuid":"84591865","full_name":"nfultz/pumpkin","owner":"nfultz","description":"Turns an EC2 node into a 🎃","archived":false,"fork":false,"pushed_at":"2020-07-14T22:03:28.000Z","size":6,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T03:41:21.449Z","etag":null,"topics":["devops","ec2"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfultz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-03-10T19:02:48.000Z","updated_at":"2023-07-25T14:07:43.000Z","dependencies_parsed_at":"2023-05-27T16:00:40.568Z","dependency_job_id":null,"html_url":"https://github.com/nfultz/pumpkin","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fpumpkin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fpumpkin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fpumpkin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfultz%2Fpumpkin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfultz","download_url":"https://codeload.github.com/nfultz/pumpkin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251211878,"owners_count":21553374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["devops","ec2"],"created_at":"2024-11-11T10:26:36.643Z","updated_at":"2025-04-27T21:31:20.301Z","avatar_url":"https://github.com/nfultz.png","language":"Shell","readme":"# Turn into a pumpkin\n\nThis is a short script for AWS to downsize a box after a heavy job has finished.\n\n## Example usage\n\nTo turn into a pumpkin after a long job:\n\n    ./long_job.sh \u0026\u0026 pumpkin2\n\nTo turn into a big pumpkin immediately:\n\n    pumpkin2 m4.10xlarge\n\n## The problem\n\n  I used to have to manually resize my development EC2 box, which is a comically tedious process:\n\n1. Go to AWS console\n2. Type in password\n3. Take out phone, type in 2FA\n4. Open EC2 instances tab\n5. Find my node in the list\n6. Shut it down\n7. Wait for it to shut down\n8. Right click and change the type\n9. Restart the box\n10. Wait for it to boot\n\n  Instead, I wanted a script that could do all this for me.\n\n## Implementation\n\n  Amazon provides a CLI tool for most of the services, which is capable of resizing a box; however,\nit is not able to resize a box that is running; you can't resize yourself.\n\n  To work around this, you can instead create a lambda function, which can shut down the dev box, resize\nand restart it.\n\n## Setup\n\n1. Create a AWS lambda function using `lambda_pumpkin.py` - it will need EC2 permissions.\n2. Copy `pumpkin2` to your box, and run it as needed.\n\nOld `pumpkin` is still here for historical reasons, but you probably don't want to use it.\n\n\n### IAM Permissions deep dive\n\nThe way pumpkin works is by using a lambda function to resize a box in-situ. The lambda will need \npermission to modify the ec2 node, and the node will need permission to call the lambda.\n\n1. When creating the lambda, it needs Ec2 permission to Shutdown, Modify, and Start.\n    * *IMPORTANT:* Crank the timeout to like 5 minutes. The default (3s) is long enough to shutdown the box, but too short to automatically restart it.\n    * You may want to restrict which boxes pumpkin can cycle using tags. See also https://aws.amazon.com/premiumsupport/knowledge-center/iam-ec2-resource-tags/\n2. Create a role that can invoke the lambda function\n    * And a policy holding that role\n    * Add the policy to the ec2 node - can use the same tag conditions as above if you like. \n    * If using tags, set them also\n\n\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfultz%2Fpumpkin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfultz%2Fpumpkin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfultz%2Fpumpkin/lists"}