Skip to content

Commit

Permalink
Make bastion host optional (defaults to disabled)
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 603fb09 commit b0a8120
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
5 changes: 4 additions & 1 deletion deployment/cdk/opensearch-service-migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ The pipeline configuration file can be viewed (and updated) via AWS Secrets Mana
## 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.

The domain & dashboard are only accessible from within the VPC, but a BastionHost is optionally set up within the VPC that allows a user to use Session Manager to make the dashboard avaiable locally via port forwarding.

For the Bastion Host to be available, add `"migrationAnalyticsBastionEnabled": true` to cdk.context.json and redeploy at least the MigrationAnalytics stack.

Run the `accessAnalyticsDashboard` script, and then open https://localhost:8157/_dashboards to view your dashboard.
```shell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"captureProxyESServiceEnabled": true,
"trafficReplayerServiceEnabled": true,
"migrationAnalyticsServiceEnabled": true,
"migrationAnalyticsBastionEnabled": false,
"dpPipelineTemplatePath": "./dp_pipeline_template.yaml"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
BastionHostLinux,
BlockDeviceVolume,
MachineImage,
Port,
SecurityGroup,
IVpc,
} from "aws-cdk-lib/aws-ec2";
Expand All @@ -15,6 +14,7 @@ import {StringParameter} from "aws-cdk-lib/aws-ssm";

export interface MigrationAnalyticsProps extends StackPropsExt {
readonly vpc: IVpc,
readonly bastionHostEnabled?: boolean
}

// The MigrationAnalyticsStack consists of the OpenTelemetry Collector ECS container & an
Expand All @@ -26,20 +26,22 @@ export class MigrationAnalyticsStack extends MigrationServiceCore {

const migrationAnalyticsSecurityGroup = SecurityGroup.fromSecurityGroupId(this, "migrationAnalyticsSGId", StringParameter.valueForStringParameter(this, `/migration/${props.stage}/${props.defaultDeployId}/analyticsDomainSGId`))

// Bastion host to access Opensearch Dashboards
new BastionHostLinux(this, "AnalyticsDashboardBastionHost", {
vpc: props.vpc,
securityGroup: migrationAnalyticsSecurityGroup,
machineImage: MachineImage.latestAmazonLinux2023(),
blockDevices: [
{
deviceName: "/dev/xvda",
volume: BlockDeviceVolume.ebs(10, {
encrypted: true,
}),
},
],
});
if (props.bastionHostEnabled) {
// Bastion host to access Opensearch Analytics Dashboard
new BastionHostLinux(this, "AnalyticsDashboardBastionHost", {
vpc: props.vpc,
securityGroup: migrationAnalyticsSecurityGroup,
machineImage: MachineImage.latestAmazonLinux2023(),
blockDevices: [
{
deviceName: "/dev/xvda",
volume: BlockDeviceVolume.ebs(10, {
encrypted: true,
}),
},
],
});
}

// Port Mappings for collector and health check
const otelCollectorPort: PortMapping = {
Expand Down Expand Up @@ -84,8 +86,6 @@ export class MigrationAnalyticsStack extends MigrationServiceCore {
},
...props
});


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class StackComposer {
const sourceClusterEndpoint = this.getContextForType('sourceClusterEndpoint', 'string', defaultValues, contextJSON)

const migrationAnalyticsServiceEnabled = this.getContextForType('migrationAnalyticsServiceEnabled', 'boolean', defaultValues, contextJSON)
const migrationAnalyticsBastionHostEnabled = this.getContextForType('migrationAnalyticsBastionEnabled', 'boolean', defaultValues, contextJSON)
const analyticsDomainEngineVersion = this.getContextForType('analyticsDomainEngineVersion', 'string', defaultValues, contextJSON)
const analyticsDomainDataNodeType = this.getContextForType('analyticsDomainDataNodeType', 'string', defaultValues, contextJSON)
const analyticsDomainDataNodeCount = this.getContextForType('analyticsDomainDataNodeCount', 'number', defaultValues, contextJSON)
Expand Down Expand Up @@ -337,6 +338,8 @@ export class StackComposer {
})
migrationAnalyticsStack = new MigrationAnalyticsStack(scope, "migration-analytics", {
stackName: `OSMigrations-${stage}-${region}-MigrationAnalytics`,
description: "This stack contains the OpenTelemetry Collector and Bastion Host",
bastionHostEnabled: migrationAnalyticsBastionHostEnabled,
vpc:networkStack.vpc,
stage: stage,
defaultDeployId: defaultDeployId,
Expand Down
1 change: 1 addition & 0 deletions deployment/cdk/opensearch-service-migration/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ These tables list all CDK context configuration values a user can specify for th
| kafkaBrokerServiceEnabled | boolean | false | Enable deploying the given service, via a new CloudFormation stack. **This stack is experimental and should only be used for development** |
| kafkaZookeeperServiceEnabled | boolean | false | Enable deploying the given service, via a new CloudFormation stack **This stack is experimental and should only be used for development** |
| migrationAnalyticsServiceEnabled | boolean | true | Enable deploying the given service, via a new CloudFormation stack. |
| migrationAnalyticsBastionEnabled | boolean | true | Enables a BastionHost to be placed within the VPC to allow port forwarding to access the Analytics Dashboard |
| trafficReplayerEnableClusterFGACAuth | boolean | true | Use the configured FGAC manager user for the OpenSearch Domain for auth of replayed requests. **Note**: This is only applicable if this CDK has setup an OpenSearch Domain <br/> and a FGAC user was setup either by the `fineGrainedManagerUserSecretManagerKeyARN` or `enableDemoAdmin` option |
| trafficReplayerGroupId | string | "logging-group-default" | The Kafka consumer group ID the Replayer will use, if not specified a default ID will be used |
| trafficReplayerExtraArgs | string | "--sigv4-auth-header-service-region es,us-east-1 --speedup-factor 5" | Extra arguments to provide to the Replayer command. This includes auth header options and other parameters supported by the [Traffic Replayer](../../../TrafficCapture/trafficReplayer/src/main/java/org/opensearch/migrations/replay/TrafficReplayer.java). |
Expand Down

0 comments on commit b0a8120

Please sign in to comment.