-
Notifications
You must be signed in to change notification settings - Fork 2
/
test1.cue
128 lines (124 loc) · 3.63 KB
/
test1.cue
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import aws "github.com/cue-sh/cfn-cue/aws/uswest2"
template: aws.#Template
template: {
Description: "This is a template"
Resources: S3Bucket1: aws.#S3.#Bucket
Resources: S3Bucket1: Properties: AccessControl: Ref: "S3AccessControl"
Resources: S3Bucket2: aws.#S3.#Bucket
Resources: S3Bucket2: {
Properties: AccessControl: "Fn::Sub": "S3AccessControl${Stuff}"
Properties: BucketEncryption: ServerSideEncryptionConfiguration: [{ServerSideEncryptionByDefault: SSEAlgorithm: "AES256"}]
}
Resources: AMISearchCustomResource: aws.#CloudFormation.#CustomResource
Resources: AMISearchCustomResource: {
Type: "Custom::AMISearch"
Properties: {
ServiceToken: "Fn::ImportValue": "AMISearchARN"
owners: "self amazon"
filters: "[{\"Name\":\"root-device-type\",\"Values\":[\"ebs\"]},{\"Name\":\"name\",\"Values\":[\"amzn-ami-hvm-????.??.?.*gp2\"]}]"
region: "Fn::Sub": "${AWS::Region}"
"executable-users": ""
}
}
Resources: EmrCluster: aws.#EMR.#Cluster
Resources: EmrCluster: Properties: {
Name: "DataBeamEmr"
ReleaseLabel: "emr-5.20.0"
Applications: [{
Name: "Ganglia"
}, {
Name: "Spark"
}, {
Name: "Hadoop"
}]
Configurations: [{
Classification: "spark"
ConfigurationProperties: maximizeResourceAllocation: "true"
}]
EbsRootVolumeSize: 16
Instances: {
MasterInstanceGroup: {
Name: "Master Instance Group"
InstanceType: "m4.large"
InstanceCount: 1
EbsConfiguration: EbsBlockDeviceConfigs: [{
VolumeSpecification: {
SizeInGB: 32
VolumeType: "gp2"
}
}]
Market: "ON_DEMAND"
}
CoreInstanceGroup: {
Name: "Core Instance Group"
InstanceType: "r4.xlarge"
InstanceCount: 2
EbsConfiguration: EbsBlockDeviceConfigs: [{
VolumeSpecification: {
SizeInGB: 32
VolumeType: "gp2"
}
}]
Market: "SPOT"
BidPrice: "0.13"
}
}
JobFlowRole: "EMR_EC2_DefaultRole"
ServiceRole: "EMR_DefaultRole"
// LogUri: "s3n://example-bucket/logs/"
ScaleDownBehavior: "TERMINATE_AT_TASK_COMPLETION"
VisibleToAllUsers: true
}
Resources: InstanceSecurityGroup: aws.#EC2.#SecurityGroup
Resources: InstanceSecurityGroup: Properties: {
GroupDescription: "Allow http to client host"
VpcId: Ref: "myVPC"
SecurityGroupIngress: [{
IpProtocol: "tcp"
FromPort: 80
ToPort: 80
CidrIp: "0.0.0.0/0"
}]
SecurityGroupEgress: [{
IpProtocol: "tcp"
FromPort: 80
ToPort: 80
CidrIp: "0.0.0.0/0"
}]
}
Resources: LaunchConfig: aws.#AutoScaling.#LaunchConfiguration
Resources: LaunchConfig: Properties: {
IamInstanceProfile: Ref: "InstanceProfile"
// ImageId: "Fn::FindInMap": ["EC2RegionMap", {
// Ref: "AWS::Region"
// }, "64"]
ImageId: "123455"
// InstanceType: "a1.4xlarge"
InstanceType: Ref: "InstanceType"
KeyName: Ref: "KeyName"
SecurityGroups: [
{"Fn::GetAtt": ["InstanceSecurityGroup", "GroupId"]},
{"Fn::GetAtt": "InstanceSecurityGroup.GroupId"},
]
UserData: "Fn::Base64": "Fn::Sub": """
#!/bin/bash -x
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
apt-get update
apt-get install -y curl nfs-common
EC2_REGION="${AWS::Region}"
DIR_TGT=/mnt/efs/
EFS_FILE_SYSTEM_ID=${EFSFileSystem}
mkdir -p $DIR_TGT
DIR_SRC=$EFS_FILE_SYSTEM_ID.efs.$EC2_REGION.amazonaws.com
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $DIR_SRC:/ $DIR_TGT
"""
}
Resources: EC2Instance: aws.#EC2.#Instance & {
Type: "AWS::EC2::Instance"
Properties: {
InstanceType: Ref: "InstanceType"
ImageId: Ref: "LatestAmiId"
}
}
}