Skip to content

Commit

Permalink
Add script + doc note to access cluster via bastion host
Browse files Browse the repository at this point in the history
Signed-off-by: Mikayla Thompson <thomika@amazon.com>
  • Loading branch information
mikaylathompson committed Nov 14, 2023
1 parent 09d33a8 commit fce7552
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions deployment/cdk/opensearch-service-migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,17 @@ echo $FETCH_MIGRATION_COMMAND

The pipeline configuration file can be viewed (and updated) via AWS Secrets Manager.

## Accessing the Migration Analytics Domain

The analytics domain receives metrics and events from the Capture Proxy and Replayer (if configured) and allows a user to visualize the progress and success of their migration.
The domain & dashboard are only accessible from within the VPC, but a BastionHost is set up within the VPC that allows a user to use Session Manager to make the dashboard avaiable locally via port forwarding.

Run the `accessAnalyticsDashboard` script, and then open https://localhost:8157/_dashboards to view your dashboard.
```shell
# ./accessAnalyticsDashboard.sh STAGE REGION
./accessAnalyticsDashboard.sh dev us-east-1
```


## Tearing down CDK
To remove all the CDK stack(s) which get created during a deployment we can execute a command similar to below
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Example usage: ./accessAnalyticsDashboard.sh dev us-east-1

stage=$1
region=$2

export AWS_DEFAULT_REGION=$region

bastion_id=$(aws ec2 describe-instances --filter Name=tag-key,Values=migration_deployment --filter Name=tag:Name,Values=BastionHost --filter Name=tag:aws:cloudformation:stack-name,Values=OSMigrations-${stage}-${region}-MigrationAnalytics | jq --raw-output '.Reservations[0].Instances[0].InstanceId')

domain_endpoint=$(aws opensearch describe-domains --domain-names migration-analytics-domain | jq --raw-output '.DomainStatusList[0].Endpoints.vpc')

JSON_STRING=$( jq -n -c\
--arg port "443" \
--arg localPort "8157" \
--arg host "$domain_endpoint" \
'{portNumber: [$port], localPortNumber: [$localPort], host: [$host]}' )

echo "Access the Analytics Dashboard at https://localhost:8157/_dashboards"

aws ssm start-session --target $bastion_id --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters "${JSON_STRING}"

0 comments on commit fce7552

Please sign in to comment.