cloudformation-template-update-stack.json 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. {
  2. "AWSTemplateFormatVersion": "2010-09-09",
  3. "Description": "The AWS CloudFormation template for this Serverless application",
  4. "Resources": {
  5. "ServerlessDeploymentBucket": {
  6. "Type": "AWS::S3::Bucket",
  7. "Properties": {
  8. "BucketEncryption": {
  9. "ServerSideEncryptionConfiguration": [
  10. {
  11. "ServerSideEncryptionByDefault": {
  12. "SSEAlgorithm": "AES256"
  13. }
  14. }
  15. ]
  16. }
  17. }
  18. },
  19. "ServerlessDeploymentBucketPolicy": {
  20. "Type": "AWS::S3::BucketPolicy",
  21. "Properties": {
  22. "Bucket": {
  23. "Ref": "ServerlessDeploymentBucket"
  24. },
  25. "PolicyDocument": {
  26. "Statement": [
  27. {
  28. "Action": "s3:*",
  29. "Effect": "Deny",
  30. "Principal": "*",
  31. "Resource": [
  32. {
  33. "Fn::Join": [
  34. "",
  35. [
  36. "arn:",
  37. {
  38. "Ref": "AWS::Partition"
  39. },
  40. ":s3:::",
  41. {
  42. "Ref": "ServerlessDeploymentBucket"
  43. },
  44. "/*"
  45. ]
  46. ]
  47. },
  48. {
  49. "Fn::Join": [
  50. "",
  51. [
  52. "arn:",
  53. {
  54. "Ref": "AWS::Partition"
  55. },
  56. ":s3:::",
  57. {
  58. "Ref": "ServerlessDeploymentBucket"
  59. }
  60. ]
  61. ]
  62. }
  63. ],
  64. "Condition": {
  65. "Bool": {
  66. "aws:SecureTransport": false
  67. }
  68. }
  69. }
  70. ]
  71. }
  72. }
  73. },
  74. "PrepDashfLogGroup": {
  75. "Type": "AWS::Logs::LogGroup",
  76. "Properties": {
  77. "LogGroupName": "/aws/lambda/hdci-wallpad-raw-to-prep"
  78. }
  79. },
  80. "IamRoleLambdaExecution": {
  81. "Type": "AWS::IAM::Role",
  82. "Properties": {
  83. "AssumeRolePolicyDocument": {
  84. "Version": "2012-10-17",
  85. "Statement": [
  86. {
  87. "Effect": "Allow",
  88. "Principal": {
  89. "Service": [
  90. "lambda.amazonaws.com"
  91. ]
  92. },
  93. "Action": [
  94. "sts:AssumeRole"
  95. ]
  96. }
  97. ]
  98. },
  99. "Policies": [
  100. {
  101. "PolicyName": {
  102. "Fn::Join": [
  103. "-",
  104. [
  105. "hnw-wallpad-etl",
  106. "dev",
  107. "lambda"
  108. ]
  109. ]
  110. },
  111. "PolicyDocument": {
  112. "Version": "2012-10-17",
  113. "Statement": [
  114. {
  115. "Effect": "Allow",
  116. "Action": [
  117. "logs:CreateLogStream",
  118. "logs:CreateLogGroup"
  119. ],
  120. "Resource": [
  121. {
  122. "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/hdci-wallpad-raw-to-prep:*"
  123. }
  124. ]
  125. },
  126. {
  127. "Effect": "Allow",
  128. "Action": [
  129. "logs:PutLogEvents"
  130. ],
  131. "Resource": [
  132. {
  133. "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/hdci-wallpad-raw-to-prep:*:*"
  134. }
  135. ]
  136. },
  137. {
  138. "Effect": "Allow",
  139. "Action": [
  140. "s3:ListBucket",
  141. "s3:GetObject"
  142. ],
  143. "Resource": "arn:aws:s3:::homenetwork-data/*"
  144. },
  145. {
  146. "Effect": "Allow",
  147. "Action": [
  148. "s3:PutObject"
  149. ],
  150. "Resource": "arn:aws:s3:::hdci-wallpad-prep/*"
  151. }
  152. ]
  153. }
  154. }
  155. ],
  156. "Path": "/",
  157. "RoleName": {
  158. "Fn::Join": [
  159. "-",
  160. [
  161. "hnw-wallpad-etl",
  162. "dev",
  163. {
  164. "Ref": "AWS::Region"
  165. },
  166. "lambdaRole"
  167. ]
  168. ]
  169. }
  170. }
  171. },
  172. "PrepDashfLambdaFunction": {
  173. "Type": "AWS::Lambda::Function",
  174. "Properties": {
  175. "Code": {
  176. "S3Bucket": {
  177. "Ref": "ServerlessDeploymentBucket"
  178. },
  179. "S3Key": "serverless/hnw-wallpad-etl/dev/1617779857545-2021-04-07T07:17:37.545Z/preprocess-hdci-wallpad-raw-to-prep.zip"
  180. },
  181. "Handler": "preprocess/lambda_function.lambda_handler",
  182. "Runtime": "python3.8",
  183. "FunctionName": "hdci-wallpad-raw-to-prep",
  184. "MemorySize": 1024,
  185. "Timeout": 180,
  186. "Environment": {
  187. "Variables": {
  188. "PREP_BUCKET": "hdci-wallpad-prep"
  189. }
  190. },
  191. "Role": {
  192. "Fn::GetAtt": [
  193. "IamRoleLambdaExecution",
  194. "Arn"
  195. ]
  196. }
  197. },
  198. "DependsOn": [
  199. "PrepDashfLogGroup"
  200. ]
  201. },
  202. "PrepDashfLambdaVersion6kG0JfRlaV9PcfPIfqXoZs7UXmFownZER3v6tOps6iY": {
  203. "Type": "AWS::Lambda::Version",
  204. "DeletionPolicy": "Retain",
  205. "Properties": {
  206. "FunctionName": {
  207. "Ref": "PrepDashfLambdaFunction"
  208. },
  209. "CodeSha256": "pzZFpQxx/iOmdihZHN62crmDKmGlSChnGjtFpayNX28="
  210. }
  211. },
  212. "PrepDashfCustomS31": {
  213. "Type": "Custom::S3",
  214. "Version": 1,
  215. "DependsOn": [
  216. "PrepDashfLambdaFunction",
  217. "CustomDashresourceDashexistingDashs3LambdaFunction"
  218. ],
  219. "Properties": {
  220. "ServiceToken": {
  221. "Fn::GetAtt": [
  222. "CustomDashresourceDashexistingDashs3LambdaFunction",
  223. "Arn"
  224. ]
  225. },
  226. "FunctionName": "hdci-wallpad-raw-to-prep",
  227. "BucketName": "homenetwork-data",
  228. "BucketConfigs": [
  229. {
  230. "Event": "s3:ObjectCreated:*",
  231. "Rules": []
  232. }
  233. ]
  234. }
  235. },
  236. "IamRoleCustomResourcesLambdaExecution": {
  237. "Type": "AWS::IAM::Role",
  238. "Properties": {
  239. "AssumeRolePolicyDocument": {
  240. "Version": "2012-10-17",
  241. "Statement": [
  242. {
  243. "Effect": "Allow",
  244. "Principal": {
  245. "Service": [
  246. "lambda.amazonaws.com"
  247. ]
  248. },
  249. "Action": [
  250. "sts:AssumeRole"
  251. ]
  252. }
  253. ]
  254. },
  255. "Policies": [
  256. {
  257. "PolicyName": {
  258. "Fn::Join": [
  259. "-",
  260. [
  261. "dev",
  262. "hnw-wallpad-etl",
  263. "custom-resources-lambda"
  264. ]
  265. ]
  266. },
  267. "PolicyDocument": {
  268. "Version": "2012-10-17",
  269. "Statement": [
  270. {
  271. "Effect": "Allow",
  272. "Resource": {
  273. "Fn::Join": [
  274. ":",
  275. [
  276. "arn",
  277. {
  278. "Ref": "AWS::Partition"
  279. },
  280. "s3",
  281. "",
  282. "",
  283. "homenetwork-data"
  284. ]
  285. ]
  286. },
  287. "Action": [
  288. "s3:PutBucketNotification",
  289. "s3:GetBucketNotification"
  290. ]
  291. },
  292. {
  293. "Effect": "Allow",
  294. "Resource": {
  295. "Fn::Join": [
  296. ":",
  297. [
  298. "arn",
  299. {
  300. "Ref": "AWS::Partition"
  301. },
  302. "lambda",
  303. {
  304. "Ref": "AWS::Region"
  305. },
  306. {
  307. "Ref": "AWS::AccountId"
  308. },
  309. "function",
  310. "*"
  311. ]
  312. ]
  313. },
  314. "Action": [
  315. "lambda:AddPermission",
  316. "lambda:RemovePermission"
  317. ]
  318. }
  319. ]
  320. }
  321. }
  322. ]
  323. }
  324. },
  325. "CustomDashresourceDashexistingDashs3LambdaFunction": {
  326. "Type": "AWS::Lambda::Function",
  327. "Properties": {
  328. "Code": {
  329. "S3Bucket": {
  330. "Ref": "ServerlessDeploymentBucket"
  331. },
  332. "S3Key": "serverless/hnw-wallpad-etl/dev/1617779857545-2021-04-07T07:17:37.545Z/custom-resources.zip"
  333. },
  334. "FunctionName": "hnw-wallpad-etl-undefined-custom-resource-existing-s3",
  335. "Handler": "s3/handler.handler",
  336. "MemorySize": 1024,
  337. "Runtime": "nodejs12.x",
  338. "Timeout": 180,
  339. "Role": {
  340. "Fn::GetAtt": [
  341. "IamRoleCustomResourcesLambdaExecution",
  342. "Arn"
  343. ]
  344. }
  345. },
  346. "DependsOn": [
  347. "IamRoleCustomResourcesLambdaExecution"
  348. ]
  349. }
  350. },
  351. "Outputs": {
  352. "ServerlessDeploymentBucketName": {
  353. "Value": {
  354. "Ref": "ServerlessDeploymentBucket"
  355. }
  356. },
  357. "PrepDashfLambdaFunctionQualifiedArn": {
  358. "Description": "Current Lambda function version",
  359. "Value": {
  360. "Ref": "PrepDashfLambdaVersion6kG0JfRlaV9PcfPIfqXoZs7UXmFownZER3v6tOps6iY"
  361. }
  362. }
  363. }
  364. }