Skip to content

bug: RDS Postgres setup error for any version prior to #12613

Closed
@circulon

Description

@circulon

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Currently if using Postgres engine for RDS the setup fails for every version of localstack prior to the latest image (c6468726fc07)

It looks like the postgres client links used in all these versions are no longer valid and throws a 404 during download.
http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-14/postgresql-14_14.17-1.pgdg120%2b1_amd64.deb

this means that there is no downgrade / previous version localstack that can be used to verify issues including 4.4.0

FYI I am using localstack-pro

Expected Behavior

The RDS postgres cluster should be created and be available for use.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

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

docker-compose up --wait

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

awslocal rds create-db-cluster \
    --db-cluster-identifier db2 \
    --engine postgres \
    --engine-version 14 \
    --database-name test \
    --master-username myuser \
    --master-user-password mypassword

NOTE: The same output and erros are generated for engine V 15, 16 & 17 though the failed client links are different

output from command

{
    "DBCluster": {
        "AllocatedStorage": 1,
        "DatabaseName": "test",
        "DBClusterIdentifier": "db2",
        "DBClusterParameterGroup": "default.postgres14",
        "Status": "error",
        "Endpoint": "localhost.localstack.cloud",
        "ReaderEndpoint": "localhost.localstack.cloud",
        "MultiAZ": false,
        "Engine": "postgres",
        "EngineVersion": "14",
        "Port": 4511,
        "MasterUsername": "myuser",
        "PreferredBackupWindow": "13:14-13:44",
        "PreferredMaintenanceWindow": "wed:06:38-wed:07:08",
        "DBClusterMembers": [],
        "VpcSecurityGroups": [
            {
                "VpcSecurityGroupId": "sg-3c2ca89fcc1977158",
                "Status": "active"
            }
        ],
        "StorageEncrypted": false,
        "DbClusterResourceId": "cluster-3dd8406a",
        "DBClusterArn": "arn:aws:rds:ap-southeast-2:000000000000:cluster:db2",
        "IAMDatabaseAuthenticationEnabled": false,
        "TagList": []
    }
}

logs

localstack-test  | Ready.
localstack-test  | 2025-05-13T06:43:15.669 DEBUG --- [et.reactor-0] l.p.c.persistence.manager  : Loading state of service rds
localstack-test  | 2025-05-13T06:43:15.789  INFO --- [et.reactor-0] l.p.c.persistence.manager  : Loading state for rds took 120 ms
localstack-test  | 2025-05-13T06:43:15.839 DEBUG --- [et.reactor-0] l.p.c.s.rds.db_utils       : Determined and reserved port 4511 (requested port None) for RDS database
localstack-test  | 2025-05-13T06:43:16.147 DEBUG --- [et.reactor-1] l.p.c.persistence.manager  : Loading state of service ec2
localstack-test  | 2025-05-13T06:43:16.636  INFO --- [et.reactor-1] l.p.c.persistence.manager  : Loading state for ec2 took 488 ms
localstack-test  | 2025-05-13T06:43:17.003  INFO --- [   Thread-16] l.p.core.utils.postgresql  : Starting PostgreSQL query listener/rewriter on port 4511->45053
localstack-test  | 2025-05-13T06:43:18.004 DEBUG --- [-functhread6] localstack.packages.api    : Starting installation of postgresql 14...
localstack-test  | 2025-05-13T06:43:18.004  WARN --- [-functhread6] l.pro.core.packages.core   : postgresql will be installed as an OS package, even though install target is _not_ set to be static.
localstack-test  | 2025-05-13T06:43:18.004 DEBUG --- [   Thread-16] l.p.core.utils.postgresql  : Connection refused in Postgres proxy server - instance not (yet) available
localstack-test  | 2025-05-13T06:43:18.005 DEBUG --- [-functhread6] localstack.utils.run       : Executing command: ['apt', '-o=dir::cache=/var/lib/localstack/cache/apt', '-o=dir::cache::archives=/var/lib/localstack/cache/apt', '-y', '--no-install-recommends', 'update']
localstack-test  | 2025-05-13T06:43:19.009 DEBUG --- [-functhread6] l.pro.core.packages.core   : Downloading packages ['postgresql-14', 'postgresql-14-postgis-3'] to folder: /var/lib/localstack/cache/apt
localstack-test  | 2025-05-13T06:43:19.009 DEBUG --- [-functhread6] localstack.utils.run       : Executing command: ['apt', '-o=dir::cache=/var/lib/localstack/cache/apt', '-o=dir::cache::archives=/var/lib/localstack/cache/apt', '-y', '--no-install-recommends', '-d', 'install', 'postgresql-14', 'postgresql-14-postgis-3']
localstack-test  | ERROR: '['apt', '-o=dir::cache=/var/lib/localstack/cache/apt', '-o=dir::cache::archives=/var/lib/localstack/cache/apt', '-y', '--no-install-recommends', '-d', 'install', 'postgresql-14', 'postgresql-14-postgis-3']': exit code 100; output: b'\nWARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n\nReading package lists...\nBuilding dependency tree...\nReading state information...\nThe following additional packages will be installed:\n  libllvm19 postgresql-14-postgis-3-scripts postgresql-client-14\nSuggested packages:\n  postgis postgresql-doc-14\nRecommended packages:\n  sysstat\nThe following NEW packages will be installed:\n  libllvm19 postgresql-14 postgresql-14-postgis-3\n  postgresql-14-postgis-3-scripts postgresql-client-14\n0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 16.1 MB/47.0 MB of archives.\nAfter this operation, 236 MB of additional disk space will be used.\nErr:1 http://apt.postgresql.org/pub/repos/apt bookworm-pgdg/main amd64 postgresql-client-14 amd64 14.17-1.pgdg120+1\n  404  Not Found [IP: 151.101.107.52 80]\nErr:2 http://apt.postgresql.org/pub/repos/apt bookworm-pgdg/main amd64 postgresql-14 amd64 14.17-1.pgdg120+1\n  404  Not Found [IP: 151.101.107.52 80]\nE: Failed to fetch http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-14/postgresql-client-14_14.17-1.pgdg120%2b1_amd64.deb  404  Not Found [IP: 151.101.107.52 80]\nE: Failed to fetch http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-14/postgresql-14_14.17-1.pgdg120%2b1_amd64.deb  404  Not Found [IP: 151.101.107.52 80]\nE: Some files failed to download\n'
localstack-test  | 2025-05-13T06:43:19.840  WARN --- [-functhread6] l.p.c.s.rds.db_utils       : Unable to startup DB instance: Installation of postgresql 14 failed. Traceback (most recent call last):
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/packages/api.py", line 91, in install
localstack-test  |     self._install(target)
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/core.py", line 25, in _install
localstack-test  |     def _install(A,target):A._os_switch(debian=A._debian_install,redhat=A._redhat_install,target=target)
localstack-test  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/core.py", line 18, in _os_switch
localstack-test  |     if is_debian()or not in_docker()and debian_fallback:return debian(**A)
localstack-test  |                                                                ^^^^^^^^^^^
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/core.py", line 32, in _debian_install
localstack-test  |     def _debian_install(A,target):B=A._debian_packages();LOG.debug('Downloading packages %s to folder: %s',B,_DEBIAN_CACHE_DIR);C=A._debian_cmd_prefix()+['-d',_A]+B;run(C);C=A._debian_cmd_prefix()+[_A]+B;run(C)
localstack-test  |                                                                                                                                                                      ^^^^^^
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/run.py", line 119, in run
localstack-test  |     raise e
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/run.py", line 69, in run
localstack-test  |     output = subprocess.check_output(cmd, shell=shell, stderr=stderr, env=env_dict, cwd=cwd)
localstack-test  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
localstack-test  |   File "/usr/local/lib/python3.11/subprocess.py", line 466, in check_output
localstack-test  |     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
localstack-test  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
localstack-test  |   File "/usr/local/lib/python3.11/subprocess.py", line 571, in run
localstack-test  |     raise CalledProcessError(retcode, process.args,
localstack-test  | subprocess.CalledProcessError: Command '['apt', '-o=dir::cache=/var/lib/localstack/cache/apt', '-o=dir::cache::archives=/var/lib/localstack/cache/apt', '-y', '--no-install-recommends', '-d', 'install', 'postgresql-14', 'postgresql-14-postgis-3']' returned non-zero exit status 100.
localstack-test  | 
localstack-test  | The above exception was the direct cause of the following exception:
localstack-test  | 
localstack-test  | Traceback (most recent call last):
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/rds/db_utils.py.enc", line 63, in A
localstack-test  |     try:B and B(status='creating');G=F.start_db_instance(*E,**D);B and B(status=_D);LOG.debug('DB started successfully.');return G
localstack-test  |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/rds/engine_postgres.py.enc", line 61, in start_db_instance
localstack-test  |     if config.is_in_docker:postgresql_package.install(version=P)
localstack-test  |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/packages/api.py", line 220, in install
localstack-test  |     self.get_installer(version).install(target)
localstack-test  |   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/packages/api.py", line 106, in install
localstack-test  |     raise PackageException(f"Installation of {self.name} {self.version} failed.") from e
localstack-test  | localstack.packages.api.PackageException: Installation of postgresql 14 failed.
localstack-test  |   
localstack-test  | 2025-05-13T06:43:20.004  INFO --- [et.reactor-0] localstack.request.aws     : AWS rds.CreateDBCluster => 200
localstack-test  | 2025-05-13T06:43:50.872 DEBUG --- [-functhread3] mailhog.server             : [APIv1] KEEPALIVE /api/v1/events

Environment

- OS: MacOS
- LocalStack:
  LocalStack version: <= 4.4.0
  LocalStack Docker image sha: all equal or prior to ac5f50b6c1a2
  LocalStack build date: 
  LocalStack build git hash:

Anything else?

My Docker compose file with comments

---
services:
  localstack:
    container_name: localstack-test
    image: localstack/localstack-pro:latest  # db setup works
 #   image: localstack/localstack-pro:stable # db setup fails
#    image: localstack/localstack-pro:4.4  # db setup fails
#    image: localstack/localstack-pro:4.3 # db setup fails
#    image: localstack/localstack-pro:4.2 # db setup fails
#    image: localstack/localstack-pro:4.1 # db setup fails
    ports:
      - "127.0.0.1:4566:4566"            # LocalStack Gateway
      - "127.0.0.1:4510-4559:4510-4559"  # external services port range
      - "127.0.0.1:53:53"                # DNS config (required for Pro)
      - "127.0.0.1:53:53/udp"            # DNS config (required for Pro)
      - "127.0.0.1:443:443"              # LocalStack HTTPS Gateway (required for Pro)
    environment:
      - LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN-}  
      - PERSISTENCE=1 # Required for data to be retained
      - DEBUG=1
      - EAGER_SERVICE_LOADING=1
      - DOCKER_HOST=unix:///var/run/docker.sock
   volumes:
      - "${TMPDIR:-/tmp}/localstack:/tmp"
      - "$PWD/localstack_data:/var/lib/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./localstack_config/bootstrap:/etc/localstack/init"
      - "./localstack_config/conf.d:/etc/localstack/conf.d"

Metadata

Metadata

Assignees

No one assigned

    Labels

    aws:rdsAmazon Relational Database Servicetype: bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions