diff --git a/CHANGELOG.md b/CHANGELOG.md index d666393..1d072ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Add ASSIGN_PUBLIC_IP configuration option [#28](https://github.com/azavea/django-ecsmanage/pull/28) ## [2.0.0] - 2020-10-13 ### Added diff --git a/README.rst b/README.rst index 89a3a57..f689e67 100644 --- a/README.rst +++ b/README.rst @@ -73,6 +73,7 @@ environment. For example: 'Environment': 'Staging', 'Project': 'ProjectName' }, + 'ASSIGN_PUBLIC_IP': 'DISABLED', 'AWS_REGION': 'us-east-1', }, } @@ -149,6 +150,9 @@ the appropriate AWS resources for your cluster: | ``SUBNET_TAGS`` | A dictionary of tags to use to identify a subnet | | | | for your task. | | +--------------------------+------------------------------------------------------------------+---------------+ +| ``ASSIGN_PUBLIC_IP`` | Whether to automatically assign a public IP address to your | ``DISABLED`` | +| | task. Can be ``ENABLED`` or ``DISABLED``. | | ++--------------------------+------------------------------------------------------------------+---------------+ | ``LAUNCH_TYPE`` | The ECS launch type for your task. | ``FARGATE`` | +--------------------------+------------------------------------------------------------------+---------------+ | ``PLATFORM_VERSION`` | The Fargate platform version, if ``LAUNCH_TYPE`` is ``FARGATE``. | ``LATEST`` | diff --git a/ecsmanage/management/commands/ecsmanage.py b/ecsmanage/management/commands/ecsmanage.py index 7bc5b7c..089d6b6 100644 --- a/ecsmanage/management/commands/ecsmanage.py +++ b/ecsmanage/management/commands/ecsmanage.py @@ -82,6 +82,7 @@ def parse_config(self): "CLUSTER_NAME": "", "SECURITY_GROUP_TAGS": "", "SUBNET_TAGS": "", + "ASSIGN_PUBLIC_IP": "DISABLED", "LAUNCH_TYPE": "FARGATE", "PLATFORM_VERSION": "LATEST", "AWS_REGION": "us-east-1", @@ -189,6 +190,7 @@ def run_task(self, config, task_def_arn, security_group_id, subnet_id, cmd): "awsvpcConfiguration": { "subnets": [subnet_id], "securityGroups": [security_group_id], + "assignPublicIp": config["ASSIGN_PUBLIC_IP"], } }