Skip to content

aws ECSCluster - Unable to create default security group. Please specify manually. #481

@alxthm

Description

@alxthm

Describe the issue:

When trying to setup a EC2Cluster from a new AWS account, with no security group named dask-default, the following RuntimeError is raised:

Unable to create default security group. Please specify manually.

It turns out that get_security_group calls create_default_security_group without specifying the required tags argument.

Minimal Complete Verifiable Example:

from dask_cloudprovider.aws import EC2Cluster
cluster = EC2Cluster(
    instance_type="c8i.large",
)

Anything else we need to know?:

I executed this from a IAM account with the following policy attached: #49 (comment).

In the end, I got it working by simply commenting out the TagSpecifications in create_default_security_group

async def create_default_security_group(client, group_name, vpc, tags):
    response = await client.create_security_group(
        Description="A default security group for Dask",
        GroupName=group_name,
        VpcId=vpc,
#        TagSpecifications=[
#            {
#                "ResourceType": "security-group",
#                "Tags": [
#                    {"Key": k, "Value": v}
#                    for k, v in (tags or {}).items()
#                    if k and v  # Filter out empty tags
#                ],
#            }
#        ],
        DryRun=False,
    )

Environment:

  • Dask version:
dask                      2025.11.0
dask-cloudprovider        2025.9.0
  • Python version: 3.12
  • Operating System: macOS, arm
  • Install method (conda, pip, source): uv

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededprovider/aws/ec2Cluster provider for AWS EC2 Instances

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions