From 0ae96694eadd4045384bc0d6770f436a484f06f5 Mon Sep 17 00:00:00 2001 From: Keiko Oda Date: Tue, 30 Apr 2024 11:52:44 +0900 Subject: [PATCH] Add AWS EKS setup section (#250) * Add AWS EKS setup section * Use the word instance instead of server for AWS --- .../MonitoringUserSetupInstructions.tsx | 4 +- directory.json | 8 + images/aws-eks.svg | 10 ++ install/amazon_rds/00_overview.mdx | 10 +- install/amazon_rds/03_install_collector.mdx | 6 + .../amazon_rds/03_install_collector_ec2.mdx | 2 +- .../amazon_rds/03_install_collector_ecs.mdx | 4 +- .../amazon_rds/03_install_collector_eks.mdx | 34 +++++ .../amazon_rds/04_configure_the_collector.mdx | 6 + .../04_configure_the_collector_docker.mdx | 6 +- .../04_configure_the_collector_ec2.mdx | 14 +- .../04_configure_the_collector_ecs.mdx | 8 +- .../04_configure_the_collector_eks.mdx | 137 ++++++++++++++++++ .../_03_create_iam_role_eks_irsa.mdx | 53 +++++++ .../_03_create_iam_role_eks_pod_identity.mdx | 53 +++++++ .../amazon_rds/_03_setup_iam_policy_cli.mdx | 2 +- install/amazon_rds/_04_setting_env_vars.mdx | 32 +++- .../amazon_rds/_04_setting_env_vars_multi.mdx | 12 +- .../_04_setting_env_vars_multi_ecs.mdx | 6 +- .../_04_setting_env_vars_multi_eks.mdx | 38 +++++ .../_04_setting_env_vars_single.mdx | 4 +- .../_04_setting_env_vars_single_eks.mdx | 29 ++++ install/amazon_rds/toc.yml | 4 + 23 files changed, 442 insertions(+), 40 deletions(-) create mode 100644 images/aws-eks.svg create mode 100644 install/amazon_rds/03_install_collector_eks.mdx create mode 100644 install/amazon_rds/04_configure_the_collector_eks.mdx create mode 100644 install/amazon_rds/_03_create_iam_role_eks_irsa.mdx create mode 100644 install/amazon_rds/_03_create_iam_role_eks_pod_identity.mdx create mode 100644 install/amazon_rds/_04_setting_env_vars_multi_eks.mdx create mode 100644 install/amazon_rds/_04_setting_env_vars_single_eks.mdx diff --git a/components/MonitoringUserSetupInstructions.tsx b/components/MonitoringUserSetupInstructions.tsx index efaf5325..889ef4ab 100644 --- a/components/MonitoringUserSetupInstructions.tsx +++ b/components/MonitoringUserSetupInstructions.tsx @@ -237,8 +237,8 @@ ${noPgMonitor ? '' : 'GRANT pg_monitor TO pganalyze;\n'} CREATE SCHEMA pganalyze; GRANT USAGE ON SCHEMA pganalyze TO pganalyze; GRANT USAGE ON SCHEMA public TO pganalyze; - -${noPgMonitor ? `CREATE OR REPLACE FUNCTION pganalyze.get_stat_replication() RETURNS SETOF pg_stat_replication AS +${noPgMonitor ? ` +CREATE OR REPLACE FUNCTION pganalyze.get_stat_replication() RETURNS SETOF pg_stat_replication AS $$ /* pganalyze-collector */ SELECT * FROM pg_catalog.pg_stat_replication; $$ LANGUAGE sql VOLATILE SECURITY DEFINER;` : ''}`} diff --git a/directory.json b/directory.json index 81ec68db..0070066e 100644 --- a/directory.json +++ b/directory.json @@ -608,6 +608,10 @@ "title": "Step 3: Install the Collector", "path": "/docs/install/amazon_rds/03_install_collector_ecs" }, + "install/amazon_rds/03_install_collector_eks": { + "title": "Step 3: Install the Collector", + "path": "/docs/install/amazon_rds/03_install_collector_eks" + }, "install/amazon_rds/04_configure_the_collector": { "title": "Step 4: Configure the Collector", "path": "/docs/install/amazon_rds/04_configure_the_collector" @@ -624,6 +628,10 @@ "title": "Step 4: Configure the Collector", "path": "/docs/install/amazon_rds/04_configure_the_collector_ecs" }, + "install/amazon_rds/04_configure_the_collector_eks": { + "title": "Step 4: Configure the Collector", + "path": "/docs/install/amazon_rds/04_configure_the_collector_eks" + }, "install/amazon_rds/iam_policy": { "title": "Amazon RDS and Aurora: IAM Policy", "path": "/docs/install/amazon_rds/iam_policy" diff --git a/images/aws-eks.svg b/images/aws-eks.svg new file mode 100644 index 00000000..6c938c39 --- /dev/null +++ b/images/aws-eks.svg @@ -0,0 +1,10 @@ + + + Icon-Architecture/64/Arch_Amazon-Elastic-Kubernetes-Service_64 + + + + + + + \ No newline at end of file diff --git a/install/amazon_rds/00_overview.mdx b/install/amazon_rds/00_overview.mdx index 44303759..2682db33 100644 --- a/install/amazon_rds/00_overview.mdx +++ b/install/amazon_rds/00_overview.mdx @@ -8,7 +8,7 @@ backlink_title: 'Installation Guide' import imgCollectorAwsArchitecture from '../../images/collector_aws_architecture.svg' export const ImgCollectorAwsArchitecture = () => -To monitor your Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL servers +To monitor your Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL instances with pganalyze, you need to run the pganalyze collector. The pganalyze collector connects to your database to capture query metadata and various statistics, then relays this information back to pganalyze on a continuous basis. @@ -17,8 +17,8 @@ ECS, or with Docker. ## Prerequisites -**Database Server** -* Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL server to monitor +**Database Instance** +* Amazon RDS for PostgreSQL or Amazon Aurora PostgreSQL instance to monitor * PostgreSQL version 10 or above * Access with an RDS superuser (master user) * Required to create a monitoring user, extensions, and helper functions @@ -30,8 +30,8 @@ ECS, or with Docker. * Capability to create an IAM policy/role for the collector * A new policy/role is required to access to the RDS metadata, Cloudwatch metrics, etc. -* A direct connection to the PostgreSQL server - * The collector instance needs to be able to connect to the server directly, +* A direct connection to the PostgreSQL instance + * The collector instance needs to be able to connect to the instance directly, bypass any connection poolers like PgBouncer Here is an overview diagram for how the pganalyze collector will be placed diff --git a/install/amazon_rds/03_install_collector.mdx b/install/amazon_rds/03_install_collector.mdx index 00f9875f..7977d8c0 100644 --- a/install/amazon_rds/03_install_collector.mdx +++ b/install/amazon_rds/03_install_collector.mdx @@ -10,6 +10,7 @@ import styles from '../../style.module.scss' import imgAwsEc2 from '../../images/aws-ec2.svg' import imgAwsEcs from '../../images/aws-ecs.svg' +import imgAwsEks from '../../images/aws-eks.svg' import imgDocker from '../../images/logo_docker.svg' export const SelectCollectorPlatform = () => { @@ -27,6 +28,11 @@ export const SelectCollectorPlatform = () => { img: imgAwsEcs, providerName: "Amazon ECS", }, + { + link: "03_install_collector_eks", + img: imgAwsEks, + providerName: "Amazon EKS", + }, { link: "03_install_collector_docker", img: imgDocker, diff --git a/install/amazon_rds/03_install_collector_ec2.mdx b/install/amazon_rds/03_install_collector_ec2.mdx index a7663d0e..8ba0c6da 100644 --- a/install/amazon_rds/03_install_collector_ec2.mdx +++ b/install/amazon_rds/03_install_collector_ec2.mdx @@ -42,7 +42,7 @@ Then follow the step to install the collector on Amazon Linux 2 based instances. -After successful installation the pganalyze collector will now be running in the background on your server. +After successful installation the pganalyze collector will now be running in the background on your instance. Proceed to Step 4: Configure the Collector diff --git a/install/amazon_rds/03_install_collector_ecs.mdx b/install/amazon_rds/03_install_collector_ecs.mdx index 739ebf59..a6ba4045 100644 --- a/install/amazon_rds/03_install_collector_ecs.mdx +++ b/install/amazon_rds/03_install_collector_ecs.mdx @@ -15,8 +15,8 @@ We will launch this container as a single persistent task using an [ECS service] ### Create IAM role -We'll need need a special IAM role to run the container with. The following -commands will create an appropriate role. +We'll need a special IAM role to run the container with. The following commands +will create an appropriate role. This assumes you are using your account's default KMS key for accessing SSM parameters. diff --git a/install/amazon_rds/03_install_collector_eks.mdx b/install/amazon_rds/03_install_collector_eks.mdx new file mode 100644 index 00000000..a9c8c184 --- /dev/null +++ b/install/amazon_rds/03_install_collector_eks.mdx @@ -0,0 +1,34 @@ +--- +title: 'Step 3: Install the Collector' +install_track_title: Installation Guide (Amazon RDS and Amazon Aurora) +backlink_href: /docs/install +backlink_title: 'Installation Guide' +--- + +import SetupIAMPolicy from './_03_setup_iam_policy.mdx'; +import CreateIAMRoleEKSIRSA from './_03_create_iam_role_eks_irsa.mdx' + +## Installing the collector with Amazon EKS + +You can install the Helm chart for the pganalyze collector on your [Amazon EKS cluster](https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html). + +### Prerequisites + +* You already have an Amazon EKS cluster +* [`kubectl`](https://kubernetes.io/docs/tasks/tools/) is installed +* [`eksctl`](https://eksctl.io/installation/) is installed and [a kubeconfig file for an Amazon EKS cluster is created](https://docs.aws.amazon.com/eks/latest/userguide/create-kubeconfig.html) +* [`The Helm CLI`](https://helm.sh/) v3 or above is installed + + + +### Create IAM role + +**Note:** Creating an IAM role currently requires using IAM roles for service +accounts (IRSA). Creating an IAM role with Amazon EKS Pod Identity is not +supported yet. + + + + + Proceed to Step 4: Configure the Collector + diff --git a/install/amazon_rds/04_configure_the_collector.mdx b/install/amazon_rds/04_configure_the_collector.mdx index 1ed4b76a..9da422b8 100644 --- a/install/amazon_rds/04_configure_the_collector.mdx +++ b/install/amazon_rds/04_configure_the_collector.mdx @@ -10,6 +10,7 @@ import styles from '../../style.module.scss' import imgAwsEc2 from '../../images/aws-ec2.svg' import imgAwsEcs from '../../images/aws-ecs.svg' +import imgAwsEks from '../../images/aws-eks.svg' import imgDocker from '../../images/logo_docker.svg' export const SelectCollectorPlatform = () => { @@ -27,6 +28,11 @@ export const SelectCollectorPlatform = () => { img: imgAwsEcs, providerName: "Amazon ECS", }, + { + link: "04_configure_the_collector_eks", + img: imgAwsEks, + providerName: "Amazon EKS", + }, { link: "04_configure_the_collector_docker", img: imgDocker, diff --git a/install/amazon_rds/04_configure_the_collector_docker.mdx b/install/amazon_rds/04_configure_the_collector_docker.mdx index 6c6eec3b..1f3fbb15 100644 --- a/install/amazon_rds/04_configure_the_collector_docker.mdx +++ b/install/amazon_rds/04_configure_the_collector_docker.mdx @@ -24,17 +24,17 @@ In the case of Amazon Aurora, the collector automatically resolves `cluster` end DB_HOST=mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com ``` -This will only monitor the writer instance. If you also want to monitor a reader instance, you'll need to use the Multiple Servers method above. +This will only monitor the writer instance. If you also want to monitor a reader instance, you'll need to use the Multiple Instances method above. ``` CONFIG_CONTENTS="[pganalyze] api_key = 'your_pga_organization_api_key' -[server_writer] +[writer_instance] db_host = mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com ... -[server_reader] +[reader_instance] db_host = mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com ... " diff --git a/install/amazon_rds/04_configure_the_collector_ec2.mdx b/install/amazon_rds/04_configure_the_collector_ec2.mdx index 9bdf1270..44602905 100644 --- a/install/amazon_rds/04_configure_the_collector_ec2.mdx +++ b/install/amazon_rds/04_configure_the_collector_ec2.mdx @@ -26,7 +26,7 @@ export const ConfigSample = ({ apiKey }) => { {`[pganalyze] api_key = ${apiKey ?? 'your_pga_organization_api_key'}\n -[server1] +[instance1] db_host = instance-id.account-id.us-east-1.rds.amazonaws.com db_name = your_database_name db_username = your_monitoring_user @@ -47,7 +47,7 @@ The collector configuration file lives in `/etc/pganalyze-collector.conf`, and l 1. 2. The `db_host` is the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) -3. The `db_name` is the database name on the Postgres server you want to monitor +3. The `db_name` is the database name on the Postgres instance you want to monitor 4. The `db_username` and `db_password` should be the monitoring user we created in Step 2 5. The `db_sslrootcert` and `db_sslmode` is the recommended SSL connection configuration that you can usually keep as specified above @@ -58,11 +58,11 @@ The collector configuration file lives in `/etc/pganalyze-collector.conf`, and l In the case of Amazon Aurora, the collector automatically resolves `cluster` endpoints to the underlying writer instance, and `cluster-ro` to the underlying reader instance: ``` -[server_writer] +[writer_instance] db_host = mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com ... -[server_reader] +[reader_instance] db_host = mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com ... ``` @@ -73,15 +73,15 @@ reader instances this is only supported in two-node clusters (i.e. single reader If you have multiple readers you want to monitor you instead need to specify each instance endpoint separately: ``` -[server_instance1] +[instance1] db_host = mydbinstance1.123456789012.us-east-1.rds.amazonaws.com ... -[server_instance2] +[instance2] db_host = mydbinstance2.123456789012.us-east-1.rds.amazonaws.com ... -[server_instance3] +[instance3] db_host = mydbinstance3.123456789012.us-east-1.rds.amazonaws.com ... ``` diff --git a/install/amazon_rds/04_configure_the_collector_ecs.mdx b/install/amazon_rds/04_configure_the_collector_ecs.mdx index e0f093ae..0fc8d538 100644 --- a/install/amazon_rds/04_configure_the_collector_ecs.mdx +++ b/install/amazon_rds/04_configure_the_collector_ecs.mdx @@ -32,19 +32,19 @@ In the case of Amazon Aurora, the collector automatically resolves `cluster` end ``` This will only monitor the writer instance. If you also want to monitor a reader instance, -you'll need to use the Multiple Servers method above and specify the reader instance as a -second server within the `pganalyze_collector.conf` file, then update the `/pganalyze/CONFIG_CONTENTS` +you'll need to use the Multiple Instances method above and specify the reader instance as a +second instance within the `pganalyze_collector.conf` file, then update the `/pganalyze/CONFIG_CONTENTS` SSM secret. ``` [pganalyze] api_key = 'your_pga_organization_api_key' -[server_writer] +[writer_instance] db_host = mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com ... -[server_reader] +[reader_instance] db_host = mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com ... ``` diff --git a/install/amazon_rds/04_configure_the_collector_eks.mdx b/install/amazon_rds/04_configure_the_collector_eks.mdx new file mode 100644 index 00000000..4f16a405 --- /dev/null +++ b/install/amazon_rds/04_configure_the_collector_eks.mdx @@ -0,0 +1,137 @@ +--- +title: 'Step 4: Configure the Collector' +install_track_title: Installation Guide (Amazon RDS and Amazon Aurora) +backlink_href: /docs/install +backlink_title: 'Installation Guide' +--- + +import PublicLastStepLogInsightsLink from '../_public_last_step_log_insights_link.mdx' +import { SettingEnvVarsEKS } from './_04_setting_env_vars.mdx'; + +export const FinishSetup = ({ inviteLink }) => { + return ( +
+ In the meantime you can invite your colleagues: + + Finish setup and invite team members + +
+ ) +} + +## Configuring the collector on Amazon EKS + +To start, download the example values.yaml file for the Helm chart: + +``` +helm show values pganalyze/pganalyze-collector > values.yaml +``` + +Update the serviceAccount section in the values.yaml file to use the role just +created in the previous step. For the name, use "pganalyze-service-account" as +specified in the assume role policy: + +```yaml +serviceAccount: + # -- Specifies whether a service account should be created + create: true + # -- Annotations to add to the service account + annotations: + eks.amazonaws.com/role-arn: "arn:aws:iam:::role/pganalyzeServiceAccountRole" + # -- The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "pganalyze-service-account" +``` + +Next, update the `extraEnv` section in the values.yaml file with the following. +This example uses `extraEnv` field for a temporary demonstration. For production +environments or any sensitive data handling, follow your organization's security +best practices and use Kubernetes secrets. + + + +**Note:** The pganalyze collector allows for more [optional settings](https://pganalyze.com/docs/collector/settings) (e.g. AWS access keys, multiple database names) + +## Handling Amazon Aurora clusters vs instances + +In the case of Amazon Aurora, the collector automatically resolves `cluster` endpoints to the underlying writer instance. + +```yaml +DB_HOST: mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com +``` + +This will only monitor the writer instance. If you also want to monitor a reader instance, +you'll need to use the Multiple Instances method above and specify the reader instance as a +second instance within the `CONFIG_CONTENTS` environment variable. + +``` +[pganalyze] +api_key = 'your_pga_organization_api_key' + +[writer_instance] +db_host = mydbcluster.cluster-123456789012.us-east-1.rds.amazonaws.com +... + +[reader_instance] +db_host = mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com +... +``` + +Alternatively, you can install a Helm chart with the separate release name to +monitor a reader instance. +Use the `cluster-ro` endpoint as the `DB_HOST` of the environment variables: + +```yaml +DB_HOST: mydbcluster.cluster-ro-123456789012.us-east-1.rds.amazonaws.com +``` + +If you have multiple readers you want to monitor, you either need to specify +using `CONFIG_CONTENTS` environment variable, or install one pganalyze collector +Helm chart for each instance. + +## Install a Helm chart + +We can now install a Helm chart to your EKS cluster. First, add a pganalyze repo: + +``` +helm repo add pganalyze https://charts.pganalyze.com/ +``` + +Then, install a chart, using the values.yaml file created earlier: + +``` +helm upgrade --install my-collector pganalyze/pganalyze-collector --values=values.yml +``` + +Adjust the namespace if needed. You can run the same command when you make a +change to the values.yaml file. + +To verify that the install went well, check the deployment: + +``` +$ kubectl get deployment +NAME READY UP-TO-DATE AVAILABLE AGE +my-collector-pganalyze-collector 1/1 1 1 1m10s +``` + +The deployment will create one pod for the collector. Check the pod name and +obtain the logs to make sure that the collector is running successfully: + +``` +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +my-collector-pganalyze-collector-7d599b49c8-dgxzk 1/1 Running 0 1m10s +$ kubectl logs my-collector-pganalyze-collector-7d599b49c8-dgxzk +I [default] Submitted compact snapshots successfully: 6 activity, 2 logs +``` + +The `Submitted compact snapshots successfully` message indicates that you have +configured the collector correctly. + +**Your setup is complete. The dashboard will start showing data within 15 minutes.** + + + + + + diff --git a/install/amazon_rds/_03_create_iam_role_eks_irsa.mdx b/install/amazon_rds/_03_create_iam_role_eks_irsa.mdx new file mode 100644 index 00000000..f93d9bbf --- /dev/null +++ b/install/amazon_rds/_03_create_iam_role_eks_irsa.mdx @@ -0,0 +1,53 @@ +With this step, you are going to create a new IAM role and associate that role +with the service account using +[IAM roles for service accounts (IRSA)](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html). + +If you haven't set up an OIDC identity provider for your EKS cluster, set it up +as follows: + +```bash +eksctl utils associate-iam-oidc-provider \ + --region --cluster mycluster --approve +``` + +Create an IAM role that will be assumed by the Kubernetes service account. The +following command will create a role named `pganalyzeServiceAccountRole`. + + +```bash +aws iam create-role --role-name pganalyzeServiceAccountRole \ + --description "For pganalyze collector service account" \ + --assume-role-policy-document '{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Federated": "arn:aws:iam:::oidc-provider/oidc.eks..amazonaws.com/id/" + }, + "Action": "sts:AssumeRoleWithWebIdentity", + "Condition": { + "StringEquals": { + "oidc.eks..amazonaws.com/id/:sub": "system:serviceaccount::pganalyze-service-account" + } + } + } + ] +}' +``` + +Replace `OIDC_PROVIDER_ID` with the one created above. You can find it using the +following command: + +``` +aws eks describe-cluster \ + --name mycluster --query "cluster.identity.oidc.issuer" --output text | cut -d '/' -f 5 +``` + +Attach the policy you created earlier to the created account. Below assumes that +the policy name is `pganalyze`: + +``` +aws iam attach-role-policy --role-name pganalyzeServiceAccountRole \ + --policy-arn arn:aws:iam:::policy/pganalyze +``` diff --git a/install/amazon_rds/_03_create_iam_role_eks_pod_identity.mdx b/install/amazon_rds/_03_create_iam_role_eks_pod_identity.mdx new file mode 100644 index 00000000..7b13bf11 --- /dev/null +++ b/install/amazon_rds/_03_create_iam_role_eks_pod_identity.mdx @@ -0,0 +1,53 @@ +With this step, you are going to create a new IAM role and associate that role +with the service account using +[Amazon EKS Pod Identity](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html). + +If you haven't installed Amazon EKS Pod Identity Agent add-on, install it with +this command: + +```bash +aws eks create-addon --cluster-name mycluster \ + --addon-name eks-pod-identity-agent +``` + +Create an IAM role that will be mapped with the Kubernetes service account. The +following command will create a role named `pganalyzeServiceAccountRole`. + + +```bash +aws iam create-role --role-name pganalyzeServiceAccountRole \ + --description "For pganalyze collector service account" \ + --assume-role-policy-document '{ + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Principal": { + "Service": "pods.eks.amazonaws.com" + }, + "Action": [ + "sts:AssumeRole", + "sts:TagSession" + ] + } + ] +}' +``` + +Attach the policy you created earlier to the created account. The command below +assumes that the policy name is `pganalyze`: + +``` +aws iam attach-role-policy --role-name pganalyzeServiceAccountRole \ + --policy-arn arn:aws:iam:::policy/pganalyze +``` + +Create Pod Identity association using the role just created: + +``` +aws eks create-pod-identity-association \ + --cluster-name mycluster \ + --namespace default \ + --service-account pganalyze-service-account \ + --role-arn arn:aws:iam::012345678901:role/pganalyzeServiceAccountRole +``` diff --git a/install/amazon_rds/_03_setup_iam_policy_cli.mdx b/install/amazon_rds/_03_setup_iam_policy_cli.mdx index d59e25f8..19548079 100644 --- a/install/amazon_rds/_03_setup_iam_policy_cli.mdx +++ b/install/amazon_rds/_03_setup_iam_policy_cli.mdx @@ -50,6 +50,6 @@ Now, create a new IAM policy named pganalyze using the saved JSON file: ```bash aws iam create-policy \ --policy-name pganalyze \ - --policy-document file://pganalyze_collector_policy.json + --policy-document file://pganalyze_collector_policy.json \ --description "Allow the pganalyze collector to access RDS information" ``` diff --git a/install/amazon_rds/_04_setting_env_vars.mdx b/install/amazon_rds/_04_setting_env_vars.mdx index 1efafbe2..c87a2988 100644 --- a/install/amazon_rds/_04_setting_env_vars.mdx +++ b/install/amazon_rds/_04_setting_env_vars.mdx @@ -4,11 +4,13 @@ import CollectorDotEnvSingle from './_04_setting_env_vars_single.mdx'; import CollectorDotEnvMulti from './_04_setting_env_vars_multi.mdx'; import CollectorDotEnvSingleECS from './_04_setting_env_vars_single_ecs.mdx'; import CollectorDotEnvMultiECS from './_04_setting_env_vars_multi_ecs.mdx'; +import CollectorDotEnvSingleEKS from './_04_setting_env_vars_single_eks.mdx'; +import CollectorDotEnvMultiEKS from './_04_setting_env_vars_multi_eks.mdx'; export const SettingEnvVarsDocker = ({ apiKey }) => { const tabs = [ - [ 'single', 'Single Server' ], - [ 'multiple', 'Multiple Servers'], + [ 'single', 'Single DB Instance' ], + [ 'multiple', 'Multiple DB Instances'], ]; return ( @@ -29,8 +31,8 @@ export const SettingEnvVarsDocker = ({ apiKey }) => { export const SettingEnvVarsECS = ({ apiKey }) => { const tabs = [ - [ 'single', 'Single Server' ], - [ 'multiple', 'Multiple Servers'], + [ 'single', 'Single DB Instance' ], + [ 'multiple', 'Multiple DB Instances'], ]; return ( @@ -48,3 +50,25 @@ export const SettingEnvVarsECS = ({ apiKey }) => { ) } + +export const SettingEnvVarsEKS = ({ apiKey }) => { + const tabs = [ + [ 'single', 'Single DB Instance' ], + [ 'multiple', 'Multiple DB Instances'], + ]; + return ( + + {(idx) => { + const tab = tabs[idx][0]; + switch (tab) { + case 'single': + return ; + case 'multiple': + return ; + default: + return null; + } + }} + + ) +} diff --git a/install/amazon_rds/_04_setting_env_vars_multi.mdx b/install/amazon_rds/_04_setting_env_vars_multi.mdx index 7a8c6097..7ca5d7fa 100644 --- a/install/amazon_rds/_04_setting_env_vars_multi.mdx +++ b/install/amazon_rds/_04_setting_env_vars_multi.mdx @@ -5,14 +5,14 @@ export const CollectorDotEnv = ({ apiKey }) => { {`CONFIG_CONTENTS="[pganalyze] api_key = ${apiKey ?? 'your_pga_organization_api_key'}\n -[server1] +[instance1] db_host = instance-id1.account-id.us-east-1.rds.amazonaws.com db_name = your_database_name db_username = your_monitoring_user db_password = your_monitoring_user_password db_sslrootcert = rds-ca-global db_sslmode = verify-full\n -[server2] +[instance2] db_host = instance-id2.account-id.us-east-1.rds.amazonaws.com db_name = your_database_name db_username = your_monitoring_user @@ -21,7 +21,7 @@ db_sslrootcert = rds-ca-global db_sslmode = verify-full"`} ) -} +}; @@ -36,13 +36,13 @@ docker run -e CONFIG_CONTENTS=" api_key = ..." quay.io/pganalyze/collector:stable test ``` -Alternatively, run one pganalyze collector Docker container for each server -using the Single Server method. +Alternatively, run one pganalyze collector Docker container for each instance +using the Single Instance method. **Fill in the values step-by-step:** 1. 2. The `db_host` is the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) -3. The `db_name` is the database name on the Postgres server you want to monitor +3. The `db_name` is the database name on the Postgres instance you want to monitor 4. The `db_username` and `db_password` should be the monitoring user we created in Step 2 5. The `db_sslrootcert` and `db_sslmode` is the recommended SSL connection configuration that you can usually keep as specified above diff --git a/install/amazon_rds/_04_setting_env_vars_multi_ecs.mdx b/install/amazon_rds/_04_setting_env_vars_multi_ecs.mdx index 479dcac8..3ab5eafa 100644 --- a/install/amazon_rds/_04_setting_env_vars_multi_ecs.mdx +++ b/install/amazon_rds/_04_setting_env_vars_multi_ecs.mdx @@ -5,14 +5,14 @@ export const MultiECSConfigFile = ({ apiKey }) => { {`[pganalyze] api_key = ${apiKey ?? 'your_pga_organization_api_key'}\n -[server1] +[instance1] db_host = instance-id1.account-id.us-east-1.rds.amazonaws.com db_name = your_database_name db_username = your_monitoring_user db_password = your_monitoring_user_password db_sslrootcert = rds-ca-global db_sslmode = verify-full\n -[server2] +[instance2] db_host = instance-id2.account-id.us-east-1.rds.amazonaws.com db_name = your_database_name db_username = your_monitoring_user @@ -31,7 +31,7 @@ To start, create an `INI` collector config file and save it as `pganalyze_collec 1. 2. The `db_host` is the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) -3. The `db_name` is the database name on the Postgres server you want to monitor +3. The `db_name` is the database name on the Postgres instance you want to monitor 4. The `db_username` and `db_password` should be the monitoring user we created in Step 2 5. The `db_sslrootcert` and `db_sslmode` is the recommended SSL connection configuration that you can usually keep as specified above diff --git a/install/amazon_rds/_04_setting_env_vars_multi_eks.mdx b/install/amazon_rds/_04_setting_env_vars_multi_eks.mdx new file mode 100644 index 00000000..69d7ae2a --- /dev/null +++ b/install/amazon_rds/_04_setting_env_vars_multi_eks.mdx @@ -0,0 +1,38 @@ +import { APIKeyInstructions } from './04_configure_the_collector_ec2.mdx' + +export const ExtraEnvMulti = ({ apiKey }) => { + return ( + + + {`extraEnv: + CONFIG_CONTENTS: | + [pganalyze] + api_key = ${apiKey ?? 'your_pga_organization_api_key'}\n + [instance1] + db_host = instance-id1.account-id.us-east-1.rds.amazonaws.com + db_name = your_database_name + db_username = your_monitoring_user + db_password = your_monitoring_user_password + db_sslrootcert = rds-ca-global + db_sslmode = verify-full\n + [instance2] + db_host = instance-id2.account-id.us-east-1.rds.amazonaws.com + db_name = your_database_name + db_username = your_monitoring_user + db_password = your_monitoring_user_password + db_sslrootcert = rds-ca-global + db_sslmode = verify-full`} + + + ) +}; + + + +**Fill in the values step-by-step:** + +1. +2. The `db_host` is the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) +3. The `db_name` is the database name on the Postgres instance you want to monitor +4. The `db_username` and `db_password` should be the monitoring user we created in Step 2 +5. The `db_sslrootcert` and `db_sslmode` is the recommended SSL connection configuration that you can usually keep as specified above diff --git a/install/amazon_rds/_04_setting_env_vars_single.mdx b/install/amazon_rds/_04_setting_env_vars_single.mdx index 559cac89..992bfa11 100644 --- a/install/amazon_rds/_04_setting_env_vars_single.mdx +++ b/install/amazon_rds/_04_setting_env_vars_single.mdx @@ -27,7 +27,7 @@ DB_SSLMODE=verify-full ) -} +}; @@ -35,6 +35,6 @@ DB_SSLMODE=verify-full 1. 2. The `DB_HOST` is the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) -3. The `DB_NAME` is the database name on the Postgres server you want to monitor +3. The `DB_NAME` is the database name on the Postgres instance you want to monitor 4. The `DB_USERNAME` and `DB_PASSWORD` should be the monitoring user we created in Step 2 5. The `DB_SSLROOTCERT` and `DB_SSLMODE` is the recommended SSL connection configuration that you can usually keep as specified above diff --git a/install/amazon_rds/_04_setting_env_vars_single_eks.mdx b/install/amazon_rds/_04_setting_env_vars_single_eks.mdx new file mode 100644 index 00000000..e7d3fe83 --- /dev/null +++ b/install/amazon_rds/_04_setting_env_vars_single_eks.mdx @@ -0,0 +1,29 @@ +import { APIKeyInstructionsEnvVar } from './_04_setting_env_vars_single.mdx' + +export const ExtraEnvSingle = ({ apiKey }) => { + return ( + + + {`extraEnv: + PGA_API_KEY: ${apiKey || "your-organization-api-key"} + DB_HOST: your_database_host + DB_NAME: your_database_name + DB_USERNAME: your_monitoring_user + DB_PASSWORD: your_monitoring_user_password + DB_SSLROOTCERT: rds-ca-global + DB_SSLMODE: verify-full +`} + + + ) +}; + + + +**Fill in the values step-by-step:** + +1. +2. The `DB_HOST` is the hostname / endpoint of your RDS instance (for Amazon Aurora you can use the cluster endpoint in many cases, see for details below) +3. The `DB_NAME` is the database name on the Postgres instance you want to monitor +4. The `DB_USERNAME` and `DB_PASSWORD` should be the monitoring user we created in Step 2 +5. The `DB_SSLROOTCERT` and `DB_SSLMODE` is the recommended SSL connection configuration that you can usually keep as specified above diff --git a/install/amazon_rds/toc.yml b/install/amazon_rds/toc.yml index c1b5011e..b18de5ec 100644 --- a/install/amazon_rds/toc.yml +++ b/install/amazon_rds/toc.yml @@ -18,6 +18,8 @@ href: install/amazon_rds/03_install_collector_ec2 - name: Amazon ECS href: install/amazon_rds/03_install_collector_ecs + - name: Amazon EKS + href: install/amazon_rds/03_install_collector_eks - name: Docker href: install/amazon_rds/03_install_collector_docker - mount: install/amazon_rds/04_configure_the_collector @@ -28,5 +30,7 @@ href: install/amazon_rds/04_configure_the_collector_ec2 - name: Amazon ECS href: install/amazon_rds/04_configure_the_collector_ecs + - name: Amazon EKS + href: install/amazon_rds/04_configure_the_collector_eks - name: Docker href: install/amazon_rds/04_configure_the_collector_docker