Advertisement
Guest User

Untitled

a guest
Sep 25th, 2019
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.44 KB | None | 0 0
  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. "LambdaLogGroup": {
  20. "Type": "AWS::Logs::LogGroup",
  21. "Properties": {
  22. "LogGroupName": "/aws/lambda/meteosuper-forecast-text-dev-lambda"
  23. }
  24. },
  25. "IamRoleLambdaExecution": {
  26. "Type": "AWS::IAM::Role",
  27. "Properties": {
  28. "AssumeRolePolicyDocument": {
  29. "Version": "2012-10-17",
  30. "Statement": [
  31. {
  32. "Effect": "Allow",
  33. "Principal": {
  34. "Service": [
  35. "lambda.amazonaws.com"
  36. ]
  37. },
  38. "Action": [
  39. "sts:AssumeRole"
  40. ]
  41. }
  42. ]
  43. },
  44. "Policies": [
  45. {
  46. "PolicyName": {
  47. "Fn::Join": [
  48. "-",
  49. [
  50. "dev",
  51. "meteosuper-forecast-text",
  52. "lambda"
  53. ]
  54. ]
  55. },
  56. "PolicyDocument": {
  57. "Version": "2012-10-17",
  58. "Statement": [
  59. {
  60. "Effect": "Allow",
  61. "Action": [
  62. "logs:CreateLogStream"
  63. ],
  64. "Resource": [
  65. {
  66. "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/meteosuper-forecast-text-dev*:*"
  67. }
  68. ]
  69. },
  70. {
  71. "Effect": "Allow",
  72. "Action": [
  73. "logs:PutLogEvents"
  74. ],
  75. "Resource": [
  76. {
  77. "Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/meteosuper-forecast-text-dev*:*:*"
  78. }
  79. ]
  80. },
  81. {
  82. "Effect": "Allow",
  83. "Action": [
  84. "dynamodb:*"
  85. ],
  86. "Resource": "*"
  87. },
  88. {
  89. "Effect": "Allow",
  90. "Action": [
  91. "iam:*"
  92. ],
  93. "Resource": "*"
  94. },
  95. {
  96. "Effect": "Allow",
  97. "Action": [
  98. "lambda:*"
  99. ],
  100. "Resource": "*"
  101. },
  102. {
  103. "Effect": "Allow",
  104. "Action": [
  105. "s3:*"
  106. ],
  107. "Resource": "*"
  108. }
  109. ]
  110. }
  111. }
  112. ],
  113. "Path": "/",
  114. "RoleName": {
  115. "Fn::Join": [
  116. "-",
  117. [
  118. "meteosuper-forecast-text",
  119. "dev",
  120. {
  121. "Ref": "AWS::Region"
  122. },
  123. "lambdaRole"
  124. ]
  125. ]
  126. }
  127. }
  128. },
  129. "LambdaLambdaFunction": {
  130. "Type": "AWS::Lambda::Function",
  131. "Properties": {
  132. "Code": {
  133. "S3Bucket": {
  134. "Ref": "ServerlessDeploymentBucket"
  135. },
  136. "S3Key": "serverless/meteosuper-forecast-text/dev/1569421132342-2019-09-25T14:18:52.342Z/meteosuper-forecast-text.zip"
  137. },
  138. "FunctionName": "meteosuper-forecast-text-dev-lambda",
  139. "Handler": "src/handler.handler",
  140. "MemorySize": 512,
  141. "Role": {
  142. "Fn::GetAtt": [
  143. "IamRoleLambdaExecution",
  144. "Arn"
  145. ]
  146. },
  147. "Runtime": "nodejs10.x",
  148. "Timeout": 180,
  149. "Description": "Get forecasts text from S3 and write them in DB",
  150. "Tags": [
  151. {
  152. "Key": "LAMBDA",
  153. "Value": "meteosuper-forecast-text-dev-lambda"
  154. }
  155. ],
  156. "Environment": {
  157. "Variables": {
  158. "STAGE": "dev"
  159. }
  160. }
  161. },
  162. "DependsOn": [
  163. "LambdaLogGroup",
  164. "IamRoleLambdaExecution"
  165. ]
  166. },
  167. "LambdaLambdaVersionIFDrlkyZQJ3IzN2ZVe9XawQdazjXWMobUXy1wUUDGE": {
  168. "Type": "AWS::Lambda::Version",
  169. "DeletionPolicy": "Retain",
  170. "Properties": {
  171. "FunctionName": {
  172. "Ref": "LambdaLambdaFunction"
  173. },
  174. "CodeSha256": "v9ZxC3nhstn8Ia+FRKVPbEZvfDG3Yy/WEfFfh41pn10=",
  175. "Description": "Get forecasts text from S3 and write them in DB"
  176. }
  177. },
  178. "LambdaCustomS31": {
  179. "Type": "Custom::S3",
  180. "Version": 1,
  181. "DependsOn": [
  182. "LambdaLambdaFunction",
  183. "CustomDashresourceDashexistingDashs3LambdaFunction"
  184. ],
  185. "Properties": {
  186. "ServiceToken": {
  187. "Fn::GetAtt": [
  188. "CustomDashresourceDashexistingDashs3LambdaFunction",
  189. "Arn"
  190. ]
  191. },
  192. "FunctionName": "meteosuper-forecast-text-dev-lambda",
  193. "BucketName": "meteo-forecasts-raw-dev",
  194. "BucketConfigs": [
  195. {
  196. "Event": "s3:ObjectCreated:*",
  197. "Rules": [
  198. {
  199. "Prefix": "xml-texts/"
  200. },
  201. {
  202. "Suffix": ".xml"
  203. }
  204. ]
  205. }
  206. ]
  207. }
  208. },
  209. "CustomDashresourceDashexistingDashs3LambdaFunction": {
  210. "Type": "AWS::Lambda::Function",
  211. "Properties": {
  212. "Code": {
  213. "S3Bucket": {
  214. "Ref": "ServerlessDeploymentBucket"
  215. },
  216. "S3Key": "serverless/meteosuper-forecast-text/dev/1569421132342-2019-09-25T14:18:52.342Z/custom-resources.zip"
  217. },
  218. "FunctionName": "meteosuper-forecast-text-dev-custom-resource-existing-s3",
  219. "Handler": "s3/handler.handler",
  220. "MemorySize": 1024,
  221. "Role": {
  222. "Fn::GetAtt": [
  223. "IamRoleCustomResourcesLambdaExecution",
  224. "Arn"
  225. ]
  226. },
  227. "Runtime": "nodejs10.x",
  228. "Timeout": 180
  229. },
  230. "DependsOn": [
  231. "IamRoleCustomResourcesLambdaExecution"
  232. ]
  233. },
  234. "IamRoleCustomResourcesLambdaExecution": {
  235. "Type": "AWS::IAM::Role",
  236. "Properties": {
  237. "AssumeRolePolicyDocument": {
  238. "Version": "2012-10-17",
  239. "Statement": [
  240. {
  241. "Effect": "Allow",
  242. "Principal": {
  243. "Service": [
  244. "lambda.amazonaws.com"
  245. ]
  246. },
  247. "Action": [
  248. "sts:AssumeRole"
  249. ]
  250. }
  251. ]
  252. },
  253. "Policies": [
  254. {
  255. "PolicyName": {
  256. "Fn::Join": [
  257. "-",
  258. [
  259. "dev",
  260. "meteosuper-forecast-text",
  261. "custom-resources-lambda"
  262. ]
  263. ]
  264. },
  265. "PolicyDocument": {
  266. "Version": "2012-10-17",
  267. "Statement": [
  268. {
  269. "Effect": "Allow",
  270. "Resource": {
  271. "Fn::Join": [
  272. ":",
  273. [
  274. "arn",
  275. {
  276. "Ref": "AWS::Partition"
  277. },
  278. "s3",
  279. "",
  280. "",
  281. "meteo-forecasts-raw-dev"
  282. ]
  283. ]
  284. },
  285. "Action": [
  286. "s3:PutBucketNotification",
  287. "s3:GetBucketNotification"
  288. ]
  289. },
  290. {
  291. "Effect": "Allow",
  292. "Resource": {
  293. "Fn::Join": [
  294. ":",
  295. [
  296. "arn",
  297. {
  298. "Ref": "AWS::Partition"
  299. },
  300. "lambda",
  301. {
  302. "Ref": "AWS::Region"
  303. },
  304. {
  305. "Ref": "AWS::AccountId"
  306. },
  307. "function",
  308. "meteosuper-forecast-text-dev-lambda"
  309. ]
  310. ]
  311. },
  312. "Action": [
  313. "lambda:AddPermission",
  314. "lambda:RemovePermission"
  315. ]
  316. }
  317. ]
  318. }
  319. }
  320. ]
  321. }
  322. }
  323. },
  324. "Outputs": {
  325. "ServerlessDeploymentBucketName": {
  326. "Value": {
  327. "Ref": "ServerlessDeploymentBucket"
  328. }
  329. },
  330. "LambdaLambdaFunctionQualifiedArn": {
  331. "Description": "Current Lambda function version",
  332. "Value": {
  333. "Ref": "LambdaLambdaVersionIFDrlkyZQJ3IzN2ZVe9XawQdazjXWMobUXy1wUUDGE"
  334. }
  335. }
  336. }
  337. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement