This repository was archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathinteg.default.ts
More file actions
75 lines (65 loc) · 2.09 KB
/
integ.default.ts
File metadata and controls
75 lines (65 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { App, ArnFormat, Aws, CfnOutput, Stack } from 'aws-cdk-lib';
import { Autoscaler, EmrEksCluster, EmrVersion } from './emr-eks-platform';
import { ManagedPolicy, PolicyStatement, User } from 'aws-cdk-lib/aws-iam';
import { NotebookPlatform, StudioAuthMode } from './notebook-platform';
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
const mockApp = new App();
const stack = new Stack(mockApp, 'EmrEksClustereE2eTest');
const emrEks = EmrEksCluster.getOrCreate(stack, {
eksAdminRoleArn: 'arn:aws:iam::123445678912:role/gromav',
autoscaling: Autoscaler.KARPENTER,
});
const virtualCluster = emrEks.addEmrVirtualCluster(stack, {
name: 'e2eTest',
createNamespace: true,
eksNamespace: 'emreks',
});
const policy = new ManagedPolicy(stack, 'MyPolicy1', {
statements: [
new PolicyStatement({
resources: ['*'],
actions: ['s3:*'],
}),
new PolicyStatement({
resources: [
stack.formatArn({
account: Aws.ACCOUNT_ID,
region: Aws.REGION,
service: 'logs',
resource: '*',
arnFormat: ArnFormat.NO_RESOURCE_NAME,
}),
],
actions: [
'logs:*',
],
}),
],
});
const execRole = emrEks.createExecutionRole(stack, 'ExecRole',
policy,
'emreks',
'emr-eks-exec-role',
);
const platform = new NotebookPlatform(stack, 'platform-notebook', {
emrEks: emrEks,
eksNamespace: 'notebook',
studioName: 'notebook',
studioAuthMode: StudioAuthMode.IAM,
});
const notebookUser = new User(stack, 'NotebookUser', {userName: 'test'});
platform.addUser([{
iamUser: notebookUser,
notebookManagedEndpoints: [
{
emrOnEksVersion: EmrVersion.V6_9,
executionPolicy: policy,
managedEndpointName: 'notebook',
},
],
}]);
// Job config for each nodegroup
new CfnOutput(stack, 'CriticalConfig', { value: emrEks.criticalDefaultConfig });
new CfnOutput(stack, 'SharedConfig', { value: emrEks.sharedDefaultConfig });
new CfnOutput(stack, 'JobExecRole', { value: execRole.roleArn });
new CfnOutput(stack, 'VirtualClusterId', { value: virtualCluster.attrId });