Skip to content

Commit

Permalink
Move IAM policy/role creation to after selecting collector platform (#…
Browse files Browse the repository at this point in the history
…237)

* Remove step3 setup iam policy and move all steps up

* Add create policy/role steps inside of each collector install
  • Loading branch information
keiko713 committed Apr 12, 2024
1 parent 2dd2b4d commit b311bd6
Show file tree
Hide file tree
Showing 19 changed files with 297 additions and 162 deletions.
52 changes: 24 additions & 28 deletions directory.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,41 +588,37 @@
"title": "Step 2: Create Monitoring User",
"path": "/docs/install/amazon_rds/02_create_monitoring_user"
},
"install/amazon_rds/03_setup_iam_policy": {
"title": "Step 3: Set Up IAM Policy",
"path": "/docs/install/amazon_rds/03_setup_iam_policy"
},
"install/amazon_rds/04_install_collector": {
"title": "Step 4: Install the Collector",
"path": "/docs/install/amazon_rds/04_install_collector"
"install/amazon_rds/03_install_collector": {
"title": "Step 3: Install the Collector",
"path": "/docs/install/amazon_rds/03_install_collector"
},
"install/amazon_rds/04_install_collector_docker": {
"title": "Step 4: Install the Collector",
"path": "/docs/install/amazon_rds/04_install_collector_docker"
"install/amazon_rds/03_install_collector_docker": {
"title": "Step 3: Install the Collector",
"path": "/docs/install/amazon_rds/03_install_collector_docker"
},
"install/amazon_rds/04_install_collector_ec2": {
"title": "Step 4: Install the Collector",
"path": "/docs/install/amazon_rds/04_install_collector_ec2"
"install/amazon_rds/03_install_collector_ec2": {
"title": "Step 3: Install the Collector",
"path": "/docs/install/amazon_rds/03_install_collector_ec2"
},
"install/amazon_rds/04_install_collector_ecs": {
"title": "Step 4: Install the Collector",
"path": "/docs/install/amazon_rds/04_install_collector_ecs"
"install/amazon_rds/03_install_collector_ecs": {
"title": "Step 3: Install the Collector",
"path": "/docs/install/amazon_rds/03_install_collector_ecs"
},
"install/amazon_rds/05_configure_the_collector": {
"title": "Step 5: Configure the Collector",
"path": "/docs/install/amazon_rds/05_configure_the_collector"
"install/amazon_rds/04_configure_the_collector": {
"title": "Step 4: Configure the Collector",
"path": "/docs/install/amazon_rds/04_configure_the_collector"
},
"install/amazon_rds/05_configure_the_collector_docker": {
"title": "Step 5: Configure the Collector",
"path": "/docs/install/amazon_rds/05_configure_the_collector_docker"
"install/amazon_rds/04_configure_the_collector_docker": {
"title": "Step 4: Configure the Collector",
"path": "/docs/install/amazon_rds/04_configure_the_collector_docker"
},
"install/amazon_rds/05_configure_the_collector_ec2": {
"title": "Step 5: Configure the Collector",
"path": "/docs/install/amazon_rds/05_configure_the_collector_ec2"
"install/amazon_rds/04_configure_the_collector_ec2": {
"title": "Step 4: Configure the Collector",
"path": "/docs/install/amazon_rds/04_configure_the_collector_ec2"
},
"install/amazon_rds/05_configure_the_collector_ecs": {
"title": "Step 5: Configure the Collector",
"path": "/docs/install/amazon_rds/05_configure_the_collector_ecs"
"install/amazon_rds/04_configure_the_collector_ecs": {
"title": "Step 4: Configure the Collector",
"path": "/docs/install/amazon_rds/04_configure_the_collector_ecs"
},
"install/azure_database/01_configure_azure_instance": {
"title": "Step 1: Configure Azure Database for PostgreSQL Instance",
Expand Down
6 changes: 3 additions & 3 deletions install/amazon_rds/02_create_monitoring_user.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Write down the username and password of the monitoring user, we will use it in t

---

Next we continue by setting up the IAM policy:
Next we continue by installing the pganalyze collector software to your environment:

<Link className="btn btn-success" to="03_setup_iam_policy">
Proceed to Step 3: Setup IAM Policy
<Link className="btn btn-success" to="03_install_collector">
Proceed to Step 3: Install the Collector
</Link>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Step 4: Install the Collector'
title: 'Step 3: Install the Collector'
install_track_title: Installation Guide (Amazon RDS and Amazon Aurora)
backlink_href: /docs/install
backlink_title: 'Installation Guide'
Expand All @@ -18,17 +18,17 @@ export const SelectCollectorPlatform = () => {
docsRoot={false}
items={[
{
link: "04_install_collector_ec2",
link: "03_install_collector_ec2",
img: imgAwsEc2,
providerName: "Amazon EC2 Instance",
},
{
link: "04_install_collector_ecs",
link: "03_install_collector_ecs",
img: imgAwsEcs,
providerName: "Amazon ECS",
},
{
link: "04_install_collector_docker",
link: "03_install_collector_docker",
img: imgDocker,
providerName: "Docker on EC2",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
---
title: 'Step 4: Install the Collector'
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 CreateIAMRole from './_03_create_iam_role.mdx';

## Installing the collector with Docker

This guide assumes that you already have the Docker daemon running on your EC2
instance.

<SetupIAMPolicy />

<CreateIAMRole />

Attach the created IAM role to the EC2 instance.

### Pull the Docker image

You can then pull the Docker image like this:

```
docker pull quay.io/pganalyze/collector:stable
```

<Link className="btn btn-success" to="05_configure_the_collector_docker">
Proceed to Step 5: Configure the Collector
<Link className="btn btn-success" to="04_configure_the_collector_docker">
Proceed to Step 4: Configure the Collector
</Link>
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
title: 'Step 4: Install the Collector'
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 CreateIAMRole from './_03_create_iam_role.mdx';
import CollectorInstallInstructions from "../../components/CollectorInstallInstructions"

import imgRdsNewInstanceRole from "../../images/rds_new_instance_role.png"
Expand All @@ -19,9 +21,15 @@ The [pganalyze collector](https://github.com/pganalyze/collector) is a daemon pr

You can either run it on a small instance (a `t3.small` suffices), or add it to an existing EC2 instance in your environment.

## Starting a new EC2 instance
<SetupIAMPolicy />

Start a new `t3.small` instance, Amazon Linux 2 based, that has the IAM role applied:
<CreateIAMRole />

If you are going to use the existing EC2 instance, attach the created IAM role to the EC2 instance.

### Start a new EC2 instance

Start a new `t3.small` instance, Amazon Linux 2 based, that has the created IAM role applied:

<p>
<ImgRdsNewInstanceRole />
Expand All @@ -30,12 +38,12 @@ Start a new `t3.small` instance, Amazon Linux 2 based, that has the IAM role app
Then follow the step to install the collector on Amazon Linux 2 based instances.


## Installing the collector on the instance
### Install the collector on the instance

<CollectorInstallInstructions apiKey={props.apiKey} />

After successful installation the pganalyze collector will now be running in the background on your server.

<Link className="btn btn-success" to="05_configure_the_collector_ec2">
Proceed to Step 5: Configure the Collector
<Link className="btn btn-success" to="04_configure_the_collector_ec2">
Proceed to Step 4: Configure the Collector
</Link>
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
---
title: 'Step 4: Install the Collector'
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';

## Installing the collector with Amazon ECS

We will launch this container as a single persistent task using an [ECS service](https://docs.aws.amazon.com/AmazonECS/latest/userguide/ecs_services.html), with secrets [stored in SSM parameters](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/specifying-sensitive-data.html).

First, we'll need 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.
<SetupIAMPolicy />

### Create IAM role

We'll need 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.

```
aws iam create-role --role-name pganalyzeTaskRole \
Expand All @@ -33,6 +41,6 @@ correct policy ARN you created earlier.

**Important:** For more complex scenarios you might want to restrict the `kms:Decrypt` permission in the policy statement above to a specific key.

<Link className="btn btn-success" to="05_configure_the_collector_ecs">
Proceed to Step 5: Configure the Collector
<Link className="btn btn-success" to="04_configure_the_collector_ecs">
Proceed to Step 4: Configure the Collector
</Link>
87 changes: 0 additions & 87 deletions install/amazon_rds/03_setup_iam_policy.mdx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Step 5: Configure the Collector'
title: 'Step 4: Configure the Collector'
install_track_title: Installation Guide (Amazon RDS and Amazon Aurora)
backlink_href: /docs/install
backlink_title: 'Installation Guide'
Expand All @@ -18,17 +18,17 @@ export const SelectCollectorPlatform = () => {
docsRoot={false}
items={[
{
link: "05_configure_the_collector_ec2",
link: "04_configure_the_collector_ec2",
img: imgAwsEc2,
providerName: "Amazon EC2 Instance",
},
{
link: "05_configure_the_collector_ecs",
link: "04_configure_the_collector_ecs",
img: imgAwsEcs,
providerName: "Amazon ECS",
},
{
link: "05_configure_the_collector_docker",
link: "04_configure_the_collector_docker",
img: imgDocker,
providerName: "Docker on EC2",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Step 5: Configure the Collector'
title: 'Step 4: Configure the Collector'
install_track_title: Installation Guide (Amazon RDS and Amazon Aurora)
backlink_href: /docs/install
backlink_title: 'Installation Guide'
Expand Down Expand Up @@ -72,4 +72,4 @@ Then run the following:
docker run --env-file pganalyze_collector.env quay.io/pganalyze/collector:stable test
```

<PublicLastStepLogInsightsLink />
<PublicLastStepLogInsightsLink />
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Step 5: Configure the Collector'
title: 'Step 4: Configure the Collector'
install_track_title: Installation Guide (Amazon RDS and Amazon Aurora)
backlink_href: /docs/install
backlink_title: 'Installation Guide'
Expand Down Expand Up @@ -96,4 +96,4 @@ $ sudo pganalyze-collector --test --reload
1999/01/01 08:04:32 I [pganalyze] Test submission successful (1010 KB received)
```

<PublicLastStepLogInsightsLink />
<PublicLastStepLogInsightsLink />
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Step 5: Configure the Collector'
title: 'Step 4: Configure the Collector'
install_track_title: Installation Guide (Amazon RDS and Amazon Aurora)
backlink_href: /docs/install
backlink_title: 'Installation Guide'
Expand Down Expand Up @@ -170,4 +170,4 @@ configured the collector correctly.
<FinishSetup inviteLink={props.inviteLink} />
</InAppOnly>

<PublicLastStepLogInsightsLink />
<PublicLastStepLogInsightsLink />
Loading

0 comments on commit b311bd6

Please sign in to comment.