-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcloudformation.template
104 lines (99 loc) · 2.63 KB
/
cloudformation.template
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
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Environment for building node-oracledb for AWS Lambda",
"Parameters": {
"KeyName": {
"Type": "String",
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance"
},
"Subnet": {
"Type": "String",
"Default": "",
"Description": "Required if installing into a VPC"
},
"InstanceSecurityGroup": {
"Type": "String",
"Default": "",
"Description": "Required if installing into a VPC"
}
},
"Conditions": {
"InVPC": {
"Fn::Not": [{
"Fn::Equals": [{"Ref": "Subnet"}, ""]
}]
}
},
"Resources": {
"BuildMachine": {
"Type": "AWS::EC2::Instance",
"Metadata": {
"Comment": "Based on an AMI (in your region) with name amzn-ami-hvm-2015.09.1.x86_64-gp2"
},
"Properties": {
"ImageId": "ami-48d38c2b",
"InstanceType": "t2.small",
"KeyName": { "Ref": "KeyName" },
"Tags": [ {"Key": "Name", "Value": "TEST-node-oracledb-lambda-build-machine"} ],
"SecurityGroupIds": [{
"Fn::If": [
"InVPC",
{ "Ref": "InstanceSecurityGroup" },
{ "Ref": "AWS::NoValue" }
]
}],
"SubnetId": {
"Fn::If": [
"InVPC",
{ "Ref": "Subnet" },
{ "Ref": "AWS::NoValue" }
]
},
"UserData": {"Fn::Base64": { "Fn::Join": ["\n",[
"#!/bin/bash -ex",
"sudo yum update",
"sudo yum install git -y",
"git clone https://github.com/nalbion/node-oracledb-lambda-test"
]]}
}
}
},
"LambdaRole": {
"Type": "AWS::IAM::Role",
"Metadata": {
"Comment": "The Lambda function runs under this role"
},
"Properties": {
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
}]
},
"Path": "/",
"Policies": [ {
"PolicyName": "node-oracledb-lambda-test_execution",
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [ {
"Effect": "Allow",
"Action": [
"logs:*",
"s3:*"
],
"Resource": [
"arn:aws:logs:*:*:*",
"arn:aws:s3:::*"
]
} ]
}
} ]
}
}
}
}