localstack / localstack

💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
https://localstack.cloud
Other
55.69k stars 3.97k forks source link

bug: "The security group 'No security groups found matching the filters provided.' does not exist" #10315

Closed textbook closed 2 months ago

textbook commented 7 months ago

Is there an existing issue for this?

Current Behavior

When you try to aws{,local} ec2 describe-security-group-rules with a --filter for which there are no results, it seems to look for a security group literally named "No security groups found matching the filters provided."

Expected Behavior

As happens if I run a --filter with no results against the actual AWS, I'd expect to get:

{
    "SecurityGroupRules": []
}

How are you starting LocalStack?

With a docker run command

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run --env DEBUG=1 --volume 'path/to/setup.sh:/etc/localstack/init/ready.d/setup.sh' localstack/localstack:3.1

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

#!/usr/bin/env bash
set -euo pipefail

echo "Creating group $GROUP_NAME"

GROUP_ID="$(awslocal ec2 create-security-group \
    --description 'Inventing a security group' \
    --group-name "$GROUP_NAME" \
    --query 'GroupId' \
    --output 'text' \
    --region "$AWS_REGION")"

echo "Authorising ingress for $GROUP_ID"

awslocal ec2 authorize-security-group-ingress \
    --group-id "$GROUP_ID" \
    --ip-permissions 'FromPort=1234,IpProtocol=tcp,IpRanges=[{CidrIp=12.34.56.78/32,Description=fakeip}],ToPort=1234' \
    --region "$AWS_REGION"

echo 'Describing all rules'

awslocal ec2 describe-security-group-rules \
    --no-paginate

echo "Describing rules for group $GROUP_ID"

awslocal ec2 describe-security-group-rules \
    --filters "Name=group-id,Values=$GROUP_ID" \
    --no-paginate

echo "Describing rules for non-existent group foobar"

awslocal ec2 describe-security-group-rules \
    --filters 'Name=group-id,Values=foobar' \
    --no-paginate

Environment

- OS: macOS 14.2.1 (23C71)
- LocalStack: 3.1

Anything else?

Also tried with other filters, e.g. (what I originally wanted) Name=tag:Whatever,Value=Else.

Full logs:

LocalStack supervisor: starting
LocalStack supervisor: localstack process (PID 15) starting

LocalStack version: 3.1.0
LocalStack build date: 2024-01-25
LocalStack build git hash: d48ada8a

2024-02-24T20:10:33.000 DEBUG --- [  MainThread] stevedore._cache           : reading /root/.cache/python-entrypoints/a805c1b8bb53c8564f2b94370c174ebf15c2adb53b103756875791ef270bc439
2024-02-24T20:10:33.002 DEBUG --- [  MainThread] stevedore._cache           : writing to /root/.cache/python-entrypoints/a805c1b8bb53c8564f2b94370c174ebf15c2adb53b103756875791ef270bc439
2024-02-24T20:10:33.003 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='_patch_botocore_json_parser', value='localstack.aws.client:_patch_botocore_json_parser', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.003 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='_publish_config_as_analytics_event', value='localstack.runtime.analytics:_publish_config_as_analytics_event', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.004 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='_publish_container_info', value='localstack.runtime.analytics:_publish_container_info', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.004 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='_run_init_scripts_on_start', value='localstack.runtime.init:_run_init_scripts_on_start', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.004 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='deprecation_warnings', value='localstack.plugins:deprecation_warnings', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.004 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='register_partition_adjusting_proxy_listener', value='localstack.plugins:register_partition_adjusting_proxy_listener', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.005 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='setup_dns_configuration_on_host', value='localstack.dns.plugins:setup_dns_configuration_on_host', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.005 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='start_dns_server', value='localstack.dns.plugins:start_dns_server', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.005 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='validate_configuration', value='localstack.services.lambda_.plugins:validate_configuration', group='localstack.hooks.on_infra_start')
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start._patch_botocore_json_parser = <function _patch_botocore_json_parser at 0xffff94ead940>)
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:_patch_botocore_json_parser
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start._publish_config_as_analytics_event = <function _publish_config_as_analytics_event at 0xffff94eaf740>)
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:_publish_config_as_analytics_event
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start._publish_container_info = <function _publish_container_info at 0xffff94eaf9c0>)
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:_publish_container_info
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start._run_init_scripts_on_start = <function _run_init_scripts_on_start at 0xffff94cf49a0>)
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:_run_init_scripts_on_start
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start.deprecation_warnings = <function deprecation_warnings at 0xffff94cf5120>)
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:deprecation_warnings
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start.register_partition_adjusting_proxy_listener = <function register_partition_adjusting_proxy_listener at 0xffff94cf4fe0>)
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : plugin localstack.hooks.on_infra_start:register_partition_adjusting_proxy_listener is disabled
2024-02-24T20:10:33.006 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start.setup_dns_configuration_on_host = <function setup_dns_configuration_on_host at 0xffff94cf5440>)
2024-02-24T20:10:33.007 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:setup_dns_configuration_on_host
2024-02-24T20:10:33.007 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start.start_dns_server = <function start_dns_server at 0xffff94cf5300>)
2024-02-24T20:10:33.007 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:start_dns_server
2024-02-24T20:10:33.007 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_start.validate_configuration = <function validate_configuration at 0xffff94d08cc0>)
2024-02-24T20:10:33.007 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_start:validate_configuration
2024-02-24T20:10:33.017 DEBUG --- [  MainThread] localstack.dns.server      : Determined fallback dns: 192.168.65.7
2024-02-24T20:10:33.017 DEBUG --- [  MainThread] localstack.dns.server      : Starting DNS servers (tcp/udp port 53 on 0.0.0.0)...
2024-02-24T20:10:33.017 DEBUG --- [  MainThread] localstack.dns.server      : Adding host .*localhost.localstack.cloud pointing to LocalStack
2024-02-24T20:10:33.017 DEBUG --- [  MainThread] localstack.dns.server      : Adding host .*localhost.localstack.cloud with record DynamicRecord(record_type=<RecordType.A: 1>, record_id=None)
2024-02-24T20:10:33.017 DEBUG --- [  MainThread] localstack.dns.server      : Adding host .*localhost.localstack.cloud with record DynamicRecord(record_type=<RecordType.AAAA: 2>, record_id=None)
2024-02-24T20:10:33.018 DEBUG --- [-functhread1] localstack.dns.server      : DNS Server started
2024-02-24T20:10:33.020 DEBUG --- [  MainThread] localstack.dns.server      : DNS server startup finished.
2024-02-24T20:10:33.021 DEBUG --- [-functhread2] l.u.c.docker_sdk_client    : Creating Docker SDK client failed: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request
    conn.request(
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/usr/local/lib/python3.11/http/client.py", line 1289, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.11/http/client.py", line 1048, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.11/http/client.py", line 986, in send
    self.connect()
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py", line 27, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 845, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request
    conn.request(
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/usr/local/lib/python3.11/http/client.py", line 1289, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.11/http/client.py", line 1048, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.11/http/client.py", line 986, in send
    self.connect()
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py", line 27, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
                        ^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 237, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/code/localstack/localstack/utils/container_utils/docker_sdk_client.py", line 75, in _create_client
    return docker.from_env(timeout=DOCKER_SDK_DEFAULT_TIMEOUT_SECONDS)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/client.py", line 96, in from_env
    return cls(
           ^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
2024-02-24T20:10:33.021 DEBUG --- [  MainThread] localstack.runtime.init    : Init scripts discovered: {BOOT: [], START: [], READY: [Script(path='/etc/localstack/init/ready.d/setup.sh', stage=READY, state=UNKNOWN)], SHUTDOWN: []}
2024-02-24T20:10:33.028 DEBUG --- [  MainThread] localstack.plugins         : Checking for the usage of deprecated community features and configs...
2024-02-24T20:10:33.029 DEBUG --- [-functhread2] l.u.c.docker_sdk_client    : Creating Docker SDK client failed: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request
    conn.request(
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/usr/local/lib/python3.11/http/client.py", line 1289, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.11/http/client.py", line 1048, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.11/http/client.py", line 986, in send
    self.connect()
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py", line 27, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 845, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 497, in _make_request
    conn.request(
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/usr/local/lib/python3.11/http/client.py", line 1289, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.11/http/client.py", line 1048, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.11/http/client.py", line 986, in send
    self.connect()
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/transport/unixconn.py", line 27, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
                        ^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 237, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 602, in get
    return self.request("GET", url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/code/localstack/localstack/utils/container_utils/docker_sdk_client.py", line 75, in _create_client
    return docker.from_env(timeout=DOCKER_SDK_DEFAULT_TIMEOUT_SECONDS)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/client.py", line 96, in from_env
    return cls(
           ^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/code/localstack/.venv/lib/python3.11/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
2024-02-24T20:10:33.030 DEBUG --- [  MainThread] localstack.dns.server      : Overwriting container DNS server to point to localhost
2024-02-24T20:10:33.036 DEBUG --- [  MainThread] localstack.utils.threads   : start_thread called without providing a custom name
2024-02-24T20:10:33.037 DEBUG --- [-functhread3] localstack.utils.run       : Executing command: whoami
2024-02-24T20:10:33.088  WARN --- [-functhread3] l.services.internal        : Enabling diagnose endpoint, please be aware that this can expose sensitive information via your network.
2024-02-24T20:10:33.091 DEBUG --- [-functhread3] localstack.utils.ssl       : Attempting to download local SSL certificate file
2024-02-24T20:10:33.209 DEBUG --- [-functhread3] localstack.utils.http      : Starting download from https://github.com/localstack/localstack-artifacts/raw/master/local-certs/server.key to /var/lib/localstack/cache/server.test.pem
2024-02-24T20:10:33.211 DEBUG --- [-functhread3] localstack.utils.http      : Done downloading https://github.com/localstack/localstack-artifacts/raw/master/local-certs/server.key, response code 200, total 9K
2024-02-24T20:10:33.214  INFO --- [-functhread6] hypercorn.error            : Running on https://0.0.0.0:4566 (CTRL + C to quit)
2024-02-24T20:10:33.214  INFO --- [-functhread6] hypercorn.error            : Running on https://0.0.0.0:4566 (CTRL + C to quit)
2024-02-24T20:10:33.339 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='acm:default', value='localstack.services.providers:acm', group='localstack.aws.provider')
2024-02-24T20:10:33.342 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='apigateway:default', value='localstack.services.providers:apigateway', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='cloudformation:default', value='localstack.services.providers:cloudformation', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='cloudwatch:default', value='localstack.services.providers:cloudwatch', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='cloudwatch:v1', value='localstack.services.providers:cloudwatch_v1', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='cloudwatch:v2', value='localstack.services.providers:cloudwatch_v2', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='config:default', value='localstack.services.providers:awsconfig', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='dynamodb:default', value='localstack.services.providers:dynamodb', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='dynamodbstreams:default', value='localstack.services.providers:dynamodbstreams', group='localstack.aws.provider')
2024-02-24T20:10:33.343 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='ec2:default', value='localstack.services.providers:ec2', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='es:default', value='localstack.services.providers:es', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='events:default', value='localstack.services.providers:events', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='firehose:default', value='localstack.services.providers:firehose', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='iam:default', value='localstack.services.providers:iam', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='kinesis:default', value='localstack.services.providers:kinesis', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='kms:default', value='localstack.services.providers:kms', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='lambda:asf', value='localstack.services.providers:lambda_asf', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='lambda:default', value='localstack.services.providers:lambda_', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='lambda:v2', value='localstack.services.providers:lambda_v2', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='logs:default', value='localstack.services.providers:logs', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='opensearch:default', value='localstack.services.providers:opensearch', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='redshift:default', value='localstack.services.providers:redshift', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='resource-groups:default', value='localstack.services.providers:resource_groups', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='resourcegroupstaggingapi:default', value='localstack.services.providers:resourcegroupstaggingapi', group='localstack.aws.provider')
2024-02-24T20:10:33.344 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='route53:default', value='localstack.services.providers:route53', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='route53resolver:default', value='localstack.services.providers:route53resolver', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3:asf', value='localstack.services.providers:s3_asf', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3:default', value='localstack.services.providers:s3', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3:legacy_v2', value='localstack.services.providers:s3_legacy_v2', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3:stream', value='localstack.services.providers:s3_stream', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3:v2', value='localstack.services.providers:s3_v2', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3:v3', value='localstack.services.providers:s3_v3', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='s3control:default', value='localstack.services.providers:s3control', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='scheduler:default', value='localstack.services.providers:scheduler', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='secretsmanager:default', value='localstack.services.providers:secretsmanager', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='ses:default', value='localstack.services.providers:ses', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='sns:default', value='localstack.services.providers:sns', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='sqs:default', value='localstack.services.providers:sqs', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='ssm:default', value='localstack.services.providers:ssm', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='stepfunctions:default', value='localstack.services.providers:stepfunctions', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='stepfunctions:legacy', value='localstack.services.providers:stepfunctions_v1', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='stepfunctions:v1', value='localstack.services.providers:stepfunctions_legacy', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='stepfunctions:v2', value='localstack.services.providers:stepfunctions_v2', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='sts:default', value='localstack.services.providers:sts', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='support:default', value='localstack.services.providers:support', group='localstack.aws.provider')
2024-02-24T20:10:33.345 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='swf:default', value='localstack.services.providers:swf', group='localstack.aws.provider')
2024-02-24T20:10:33.346 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='transcribe:default', value='localstack.services.providers:transcribe', group='localstack.aws.provider')
Ready.
2024-02-24T20:10:33.346 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='_run_init_scripts_on_ready', value='localstack.runtime.init:_run_init_scripts_on_ready', group='localstack.hooks.on_infra_ready')
2024-02-24T20:10:33.346 DEBUG --- [  MainThread] stevedore.extension        : found extension EntryPoint(name='register_virtual_host_routes', value='localstack.services.s3.virtual_host:register_virtual_host_routes', group='localstack.hooks.on_infra_ready')
2024-02-24T20:10:33.347 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_ready._run_init_scripts_on_ready = <function _run_init_scripts_on_ready at 0xffff94cf4ae0>)
2024-02-24T20:10:33.347 DEBUG --- [  MainThread] plugin.manager             : loading plugin localstack.hooks.on_infra_ready:_run_init_scripts_on_ready
2024-02-24T20:10:33.347 DEBUG --- [  MainThread] plugin.manager             : instantiating plugin PluginSpec(localstack.hooks.on_infra_ready.register_virtual_host_routes = <function register_virtual_host_routes at 0xffff8c2c1300>)
2024-02-24T20:10:33.347 DEBUG --- [  MainThread] plugin.manager             : plugin localstack.hooks.on_infra_ready:register_virtual_host_routes is disabled
2024-02-24T20:10:33.347 DEBUG --- [  MainThread] localstack.runtime.init    : Running READY script /etc/localstack/init/ready.d/setup.sh
Creating group my.security.group
2024-02-24T20:10:33.588 DEBUG --- [   asgi_gw_0] rolo.gateway.wsgi          : POST localhost:4566/
2024-02-24T20:10:33.588 DEBUG --- [   asgi_gw_0] l.a.p.service_router       : building service catalog index cache file /var/lib/localstack/cache/service-catalog-3_1_0-1_34_23.pickle
2024-02-24T20:10:34.906 DEBUG --- [   asgi_gw_0] plugin.manager             : instantiating plugin PluginSpec(localstack.aws.provider.ec2:default = <function ec2 at 0xffff8de99ee0>)
2024-02-24T20:10:34.907 DEBUG --- [   asgi_gw_0] plugin.manager             : loading plugin localstack.aws.provider:ec2:default
2024-02-24T20:10:35.414  INFO --- [   asgi_gw_0] localstack.utils.bootstrap : Execution of "_load_service_plugin" took 507.32ms
2024-02-24T20:10:35.414  INFO --- [   asgi_gw_0] localstack.utils.bootstrap : Execution of "require" took 507.43ms
2024-02-24T20:10:35.506  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.CreateSecurityGroup => 200
Authorising ingress for sg-0313b30c4ffe931f9
2024-02-24T20:10:35.761 DEBUG --- [   asgi_gw_0] rolo.gateway.wsgi          : POST localhost:4566/
2024-02-24T20:10:35.769  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.AuthorizeSecurityGroupIngress => 200
{
    "Return": true,
    "SecurityGroupRules": [
        {
            "SecurityGroupRuleId": "sgr-74bbc67d2ba4908d1",
            "GroupId": "sg-0313b30c4ffe931f9",
            "GroupOwnerId": "000000000000",
            "IsEgress": false,
            "IpProtocol": "tcp",
            "FromPort": 1234,
            "ToPort": 1234,
            "CidrIpv4": "12.34.56.78/32",
            "Description": "fakeip"
        }
    ]
}
Describing all rules
2024-02-24T20:10:36.036 DEBUG --- [   asgi_gw_0] rolo.gateway.wsgi          : POST localhost:4566/
2024-02-24T20:10:36.041  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.DescribeSecurityGroupRules => 200
{
    "SecurityGroupRules": [
        {
            "SecurityGroupRuleId": "sgr-8bd2e642e7bc72ad5",
            "GroupId": "sg-0edaf96c6c8373b57",
            "GroupOwnerId": "000000000000",
            "IsEgress": true,
            "IpProtocol": "-1",
            "CidrIpv4": "0.0.0.0/0"
        },
        {
            "SecurityGroupRuleId": "sgr-74bbc67d2ba4908d1",
            "GroupId": "sg-0313b30c4ffe931f9",
            "GroupOwnerId": "000000000000",
            "IsEgress": false,
            "IpProtocol": "tcp",
            "FromPort": 1234,
            "ToPort": 1234,
            "CidrIpv4": "12.34.56.78/32"
        },
        {
            "SecurityGroupRuleId": "sgr-6cbfc74aea8ee7bb9",
            "GroupId": "sg-0313b30c4ffe931f9",
            "GroupOwnerId": "000000000000",
            "IsEgress": true,
            "IpProtocol": "-1",
            "CidrIpv4": "0.0.0.0/0"
        }
    ]
}
Describing rules for group sg-0313b30c4ffe931f9
2024-02-24T20:10:36.310 DEBUG --- [   asgi_gw_0] rolo.gateway.wsgi          : POST localhost:4566/
2024-02-24T20:10:36.312  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.DescribeSecurityGroupRules => 200
{
    "SecurityGroupRules": [
        {
            "SecurityGroupRuleId": "sgr-74bbc67d2ba4908d1",
            "GroupId": "sg-0313b30c4ffe931f9",
            "GroupOwnerId": "000000000000",
            "IsEgress": false,
            "IpProtocol": "tcp",
            "FromPort": 1234,
            "ToPort": 1234,
            "CidrIpv4": "12.34.56.78/32"
        },
        {
            "SecurityGroupRuleId": "sgr-6cbfc74aea8ee7bb9",
            "GroupId": "sg-0313b30c4ffe931f9",
            "GroupOwnerId": "000000000000",
            "IsEgress": true,
            "IpProtocol": "-1",
            "CidrIpv4": "0.0.0.0/0"
        }
    ]
}
Describing rules for non-existent group foobar
2024-02-24T20:10:36.584 DEBUG --- [   asgi_gw_0] rolo.gateway.wsgi          : POST localhost:4566/
2024-02-24T20:10:36.590  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.DescribeSecurityGroupRules => 400 (InvalidGroup.NotFound)

An error occurred (InvalidGroup.NotFound) when calling the DescribeSecurityGroupRules operation: The security group 'No security groups found matching the filters provided.' does not exist
2024-02-24T20:10:36.636 ERROR --- [  MainThread] localstack.runtime.init    : Error while running script Script(path='/etc/localstack/init/ready.d/setup.sh', stage=READY, state=ERROR)
Traceback (most recent call last):
  File "/opt/code/localstack/localstack/runtime/init.py", line 136, in run_stage
    runner.run(script.path)
  File "/opt/code/localstack/localstack/runtime/init.py", line 71, in run
    raise OSError("Script %s returned a non-zero exit code %s" % (path, exit_code))
OSError: Script /etc/localstack/init/ready.d/setup.sh returned a non-zero exit code 255
localstack-bot commented 7 months ago

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

textbook commented 7 months ago

More frustratingly, it seems to do this even when there should be results, e.g. for script:

#!/usr/bin/env bash
set -euo pipefail

awslocal --version

DESCRIPTION='description'

GROUP_ID="$(awslocal ec2 describe-security-groups \
    --group-names 'default' \
    --output 'text' \
    --query 'SecurityGroups[0].GroupId')"

RULE_ID="$(awslocal ec2 authorize-security-group-ingress \
    --group-id "$GROUP_ID" \
    --ip-permissions 'FromPort=1234,'\
'IpProtocol=tcp,'\
"IpRanges=[{CidrIp=12.34.56.78/32,Description=$DESCRIPTION}],"\
'ToPort=1234' \
    --output 'text' \
    --query 'SecurityGroupRules[0].SecurityGroupRuleId' \
    --region "$AWS_REGION")"

echo "Created security group rule $RULE_ID"

awslocal ec2 create-tags \
    --resources "$RULE_ID" \
    --tags "Key=Description,Value=$DESCRIPTION"

awslocal ec2 describe-tags --filters "Name=resource-id,Values=$RULE_ID"

awslocal ec2 describe-security-group-rules --filters "Name=tag:Description,Values=$DESCRIPTION"

Output:


LocalStack version: 3.1.0
LocalStack build date: 2024-01-25
LocalStack build git hash: d48ada8a

2024-02-25T16:13:27.955  INFO --- [-functhread6] hypercorn.error            : Running on https://0.0.0.0:4566 (CTRL + C to quit)
2024-02-25T16:13:27.955  INFO --- [-functhread6] hypercorn.error            : Running on https://0.0.0.0:4566 (CTRL + C to quit)
2024-02-25T16:13:28.100  INFO --- [  MainThread] localstack.utils.bootstrap : Execution of "start_runtime_components" took 613.01ms
Ready.
aws-cli/1.32.27 Python/3.11.7 Linux/6.6.12-linuxkit botocore/1.34.27
2024-02-25T16:13:30.577  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.DescribeSecurityGroups => 200
2024-02-25T16:13:30.852  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.AuthorizeSecurityGroupIngress => 200
Created security group rule sgr-185df2bdb979f4d5c
2024-02-25T16:13:31.131  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.CreateTags => 200
2024-02-25T16:13:31.389  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.DescribeTags => 200
{
    "Tags": [
        {
            "Key": "Description",
            "ResourceId": "sgr-185df2bdb979f4d5c",
            "ResourceType": "security-group-rule",
            "Value": "description"
        }
    ]
}
2024-02-25T16:13:31.662  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS ec2.DescribeSecurityGroupRules => 400 (InvalidGroup.NotFound)

An error occurred (InvalidGroup.NotFound) when calling the DescribeSecurityGroupRules operation: The security group 'No security groups found matching the filters provided.' does not exist
2024-02-25T16:13:31.706 ERROR --- [  MainThread] localstack.runtime.init    : Error while running script Script(path='/etc/localstack/init/ready.d/setup.sh', stage=READY, state=ERROR): Script /etc/localstack/init/ready.d/setup.sh returned a non-zero exit code 255
pinzon commented 5 months ago

I wanted to provide an update on this issue. The latest image of LS now includes the ability to filter security group rules using tags. However, there is still ongoing work to address the bug you initially mentioned. Thank you for your understanding.

pinzon commented 2 months ago

The PR that addresses this issue has been merged. So I'm closing this issue.

textbook commented 2 months ago

Great, thank you for the update @pinzon