dask / dask/dask-cloudprovider

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

Open
#481 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted provider/aws/ec2
Dominant language
Python
Stars
147
Forks
119
PR merge metrics
No merged PRs in 30d

Description

**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**:

```python
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: https://github.com/dask/dask-cloudprovider/issues/49#issuecomment-592703827.

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

```python
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.