Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOPqV-0000mN-Iy for pgsql-general@arkaria.postgresql.org; Wed, 08 May 2019 16:55:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hOPqU-0000Sr-77 for pgsql-general@arkaria.postgresql.org; Wed, 08 May 2019 16:55:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOPqT-0000Dr-In for pgsql-general@lists.postgresql.org; Wed, 08 May 2019 16:55:05 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOPqQ-0006Q8-Vb for pgsql-general@postgresql.org; Wed, 08 May 2019 16:55:04 +0000 Received: by mail-pf1-x444.google.com with SMTP id u17so10797926pfn.7 for ; Wed, 08 May 2019 09:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ardentperf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=++yCgg1d/IAdKqT0rBWxuRigG5uat1S7fOBwBa/IP6g=; b=wIZ0+XM6ZMc1gyvioCmOTu1OiNposDuXKRra7bJIfGKuUBcYC2Jo3oXf4W/ccAmPHx BSqOy33ZQMWs08cwLFhLCYHg/e4EaU3cqM9J1at9kX9VtgfDgRmmM5bIWZqzraFR0aVH G0VKgH4AWEj6JJmNQzqzQwnHNlG2uqXuDDOViPDIOGKOIuwecepQUKWmFSeVJdOlDCcI HRDvTD2hceIgiqYDe/b/UiH2L9vkL5SN7Nb0k6E10QnrX02avnJd0pXR83ovCoJJbXHa vacB8wlAChN1iuyo5BnxgMg91IAOj18L5eyaBePuj+QsGYyLJJZ81krCxmIHysnpE0G3 rVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=++yCgg1d/IAdKqT0rBWxuRigG5uat1S7fOBwBa/IP6g=; b=tQ44ImZ+KKAv8hIQOOvPgix1h0q/vDyDJDTrh58eIPasmffHxUpQGUCa8b2wYX8hkA h1x9qZhnljfH5Is2p3fTz8alyOe+3/XI4ib3+PdxBshRAeEfIt5Z2Ht9lSScHJAImGyd fbMQO2nK0tf5WgFUZrq1GXnj0MtKZqz0jlPVISj8ZQddb/jf/82cMXbk1guCyH3tRbNy GjBJl1h6h+m6sCXBU0Iia+cnFdcDEmXVdfa6HTc0Vt1m+byC4yZcuWXm5n/Ib6vO0b5Y owxH2sLvQ1ti9Kh4D9Gz108kYVLb/bSydkUxNJKEQCsVJVdVonpAqvhnxrxVc2GQuRRO 56SQ== X-Gm-Message-State: APjAAAUofolQB3exfLNUzgS0XsIwxdB8nvNk/LToBphdkgKWbMHMRpU6 4XCs6rUTakDJBbHEmgFrv70KhBfv9zw= X-Google-Smtp-Source: APXvYqw1cL3dO8OVdIhI5mg9bjBAMaeLbRzYiRa7Gb+f/SpZxvKuFI3mE46rjjPbiObcPN64aYXsmQ== X-Received: by 2002:a63:e451:: with SMTP id i17mr48617102pgk.312.1557334501241; Wed, 08 May 2019 09:55:01 -0700 (PDT) Received: from 186590ce269b.ant.amazon.com (54-240-196-168.amazon.com. [54.240.196.168]) by smtp.gmail.com with ESMTPSA id z19sm20095348pgk.28.2019.05.08.09.55.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 May 2019 09:55:00 -0700 (PDT) Subject: Re: PostgreSQL on Amazon RDS To: Rashmi V Bharadwaj , pgsql-general@postgresql.org References: From: Jeremy Schneider Message-ID: <68e89318-e125-0ca0-515d-fe96a0c9486e@ardentperf.com> Date: Wed, 8 May 2019 09:54:59 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/6/19 23:27, Rashmi V Bharadwaj wrote: > Is there a SQL query or a database parameter setting that I can use from > an external application to determine if the PostgreSQL database is on > cloud (like on Amazon RDS or IBM cloud) or on a non-cloud on-prem > environment? Here's my psqlrc file which has pretty solid logic for detecting between Community PostgreSQL, RDS PostgreSQL and Aurora PostgreSQL. Note that it just assumes "community/oss" as a default if it doesn't detect the other two. Should be easy enough to add detection of other hosted environments into the query with the "priority" column (as long as there's a reliable way to detect). https://gist.github.com/ardentperf/52bd418e44b1be26d7b63af21331cece This psqlrc also detects read-write versus read-only (e.g. hot standby), and the usual username/database/superuser info and builds everything into the prompt in a way that suits me. -Jeremy -- http://about.me/jeremy_schneider