self-destruct


Nameself-destruct JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA simple way for EC2 instances to stop/terminate themselves.
upload_time2025-07-26 16:36:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords aws ec2 terminate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =============
SELF DESTRUCT
=============

.. |---| unicode:: U+2014
           :trim:

.. image:: https://img.shields.io/pypi/v/self-destruct.svg?style=for-the-badge
   :target: https://pypi.org/project/self-destruct/

``self-destruct`` is a simple Python library for stopping and terminating EC2
instances from within themselves, which is not officially supported by AWS.
Usage is very simple:

.. code-block:: python

    from self_destruct import self_destruct

    self_destruct()

The only customization option is the specification of a parameter
``terminate: bool = True`` which allows the user to specify whether they want to
terminate the instance or merely stop it.

Note that in order for this function to be successful, the EC2 instance must
have the following permissions:

::

    "ec2:DescribeInstances"
    "ec2:StopInstances"
    "ec2:TerminateInstances"

Additionally, ``self-destruct`` can be run in module mode to ensure that the
instance is terminated when the Python script exits, regardless of whether any
errors are raised. To run as a module, use the following commandline syntax:

::

    python -m self_destruct [-o (stop | terminate)] (-m module | pyfile) [args ...]

When using ``-o``, any argument other than ``stop`` will result in instance
termination. This choice was made to ensure that a typo in the argument name
does not result in the instance failing to terminate.

^^^^^^^
WARNING
^^^^^^^

You are responsible for ensuring that your AWS instance terminates, and the
author of this package is not liable for any costs associated with the failure
of this package to actually terminate your instances.

In particular, this package cannot stop/terminate your instances if
``self_destruct()`` is never run |---| use module-mode to ensure that an uncaught
Python exception does not prevent ``self_destruct()`` from being called. There
is no protection from another program or the operating system killing the
program before ``self_destruct()`` can be called, even in module-mode, however.
It is your responsibility to ensure that this does not happen.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "self-destruct",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "AWS, EC2, terminate",
    "author": null,
    "author_email": "Tom Morrell <Thomas.Albert.Morrell@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/12/b8/75212c86b369a29d6c038f70dbc9513de5419106d342ea8f31a5e62bb9a0/self_destruct-0.1.0.tar.gz",
    "platform": null,
    "description": "=============\nSELF DESTRUCT\n=============\n\n.. |---| unicode:: U+2014\n           :trim:\n\n.. image:: https://img.shields.io/pypi/v/self-destruct.svg?style=for-the-badge\n   :target: https://pypi.org/project/self-destruct/\n\n``self-destruct`` is a simple Python library for stopping and terminating EC2\ninstances from within themselves, which is not officially supported by AWS.\nUsage is very simple:\n\n.. code-block:: python\n\n    from self_destruct import self_destruct\n\n    self_destruct()\n\nThe only customization option is the specification of a parameter\n``terminate: bool = True`` which allows the user to specify whether they want to\nterminate the instance or merely stop it.\n\nNote that in order for this function to be successful, the EC2 instance must\nhave the following permissions:\n\n::\n\n    \"ec2:DescribeInstances\"\n    \"ec2:StopInstances\"\n    \"ec2:TerminateInstances\"\n\nAdditionally, ``self-destruct`` can be run in module mode to ensure that the\ninstance is terminated when the Python script exits, regardless of whether any\nerrors are raised. To run as a module, use the following commandline syntax:\n\n::\n\n    python -m self_destruct [-o (stop | terminate)] (-m module | pyfile) [args ...]\n\nWhen using ``-o``, any argument other than ``stop`` will result in instance\ntermination. This choice was made to ensure that a typo in the argument name\ndoes not result in the instance failing to terminate.\n\n^^^^^^^\nWARNING\n^^^^^^^\n\nYou are responsible for ensuring that your AWS instance terminates, and the\nauthor of this package is not liable for any costs associated with the failure\nof this package to actually terminate your instances.\n\nIn particular, this package cannot stop/terminate your instances if\n``self_destruct()`` is never run |---| use module-mode to ensure that an uncaught\nPython exception does not prevent ``self_destruct()`` from being called. There\nis no protection from another program or the operating system killing the\nprogram before ``self_destruct()`` can be called, even in module-mode, however.\nIt is your responsibility to ensure that this does not happen.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple way for EC2 instances to stop/terminate themselves.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/TomMorrell/self-destruct",
        "Issues": "https://github.com/TomMorrell/self-destruct/issues"
    },
    "split_keywords": [
        "aws",
        " ec2",
        " terminate"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2ff58a8288b5dc432f1a927741e6961d1f096e92569e004af6fc28b717e5e037",
                "md5": "f1e11d7a948c9c4ffcc4faff5ff4f6fa",
                "sha256": "8bd3e84d9cbc93941ca74339740e83fcd81f1ba671bb81e13698b0d6c60ee1e5"
            },
            "downloads": -1,
            "filename": "self_destruct-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f1e11d7a948c9c4ffcc4faff5ff4f6fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4256,
            "upload_time": "2025-07-26T16:36:09",
            "upload_time_iso_8601": "2025-07-26T16:36:09.515318Z",
            "url": "https://files.pythonhosted.org/packages/2f/f5/8a8288b5dc432f1a927741e6961d1f096e92569e004af6fc28b717e5e037/self_destruct-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "12b875212c86b369a29d6c038f70dbc9513de5419106d342ea8f31a5e62bb9a0",
                "md5": "85ed039d751b169379075f136b903e83",
                "sha256": "d1d77d9d86c18d44734e040be9d5bb3fbfaf8d43578685f9fed4d5784d8c2cb3"
            },
            "downloads": -1,
            "filename": "self_destruct-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "85ed039d751b169379075f136b903e83",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 3861,
            "upload_time": "2025-07-26T16:36:10",
            "upload_time_iso_8601": "2025-07-26T16:36:10.803487Z",
            "url": "https://files.pythonhosted.org/packages/12/b8/75212c86b369a29d6c038f70dbc9513de5419106d342ea8f31a5e62bb9a0/self_destruct-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-26 16:36:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TomMorrell",
    "github_project": "self-destruct",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "self-destruct"
}
        
Elapsed time: 2.12468s