instance-scheduler.template.aws-us-gov 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730
  1. {
  2. "Description": "(SO0030) - aws-instance-scheduler, version v1.3.3",
  3. "AWSTemplateFormatVersion": "2010-09-09",
  4. "Metadata": {
  5. "AWS::CloudFormation::Interface": {
  6. "ParameterGroups": [
  7. {
  8. "Label": {
  9. "default": "Scheduler (version v1.3.3)"
  10. },
  11. "Parameters": [
  12. "TagName",
  13. "ScheduledServices",
  14. "ScheduleRdsClusters",
  15. "CreateRdsSnapshot",
  16. "SchedulingActive",
  17. "Regions",
  18. "DefaultTimezone",
  19. "CrossAccountRoles",
  20. "ScheduleLambdaAccount",
  21. "SchedulerFrequency",
  22. "MemorySize"
  23. ]
  24. },
  25. {
  26. "Label": {
  27. "default": "Options"
  28. },
  29. "Parameters": [
  30. "UseCloudWatchMetrics",
  31. "SendAnonymousData",
  32. "Trace"
  33. ]
  34. },
  35. {
  36. "Label": {
  37. "default": "Other parameters"
  38. },
  39. "Parameters": [
  40. "LogRetentionDays",
  41. "StartedTags",
  42. "StoppedTags"
  43. ]
  44. }
  45. ],
  46. "ParameterLabels": {
  47. "LogRetentionDays": {
  48. "default": "Log retention days"
  49. },
  50. "StartedTags": {
  51. "default": "Started tags"
  52. },
  53. "StoppedTags": {
  54. "default": "Stopped tags"
  55. },
  56. "SchedulingActive": {
  57. "default": "Scheduling enabled"
  58. },
  59. "CrossAccountRoles": {
  60. "default": "Cross-account roles"
  61. },
  62. "ScheduleLambdaAccount": {
  63. "default": "This account"
  64. },
  65. "UseCloudWatchMetrics": {
  66. "default": "Enable CloudWatch Metrics"
  67. },
  68. "Trace": {
  69. "default": "Enable CloudWatch Logs"
  70. },
  71. "TagName": {
  72. "default": "Instance Scheduler tag name"
  73. },
  74. "ScheduledServices": {
  75. "default": "Service(s) to schedule"
  76. },
  77. "ScheduleRdsClusters": {
  78. "default": "Schedule Aurora Clusters"
  79. },
  80. "CreateRdsSnapshot": {
  81. "default": "Create RDS instance snapshot"
  82. },
  83. "DefaultTimezone": {
  84. "default": "Default time zone"
  85. },
  86. "SchedulerFrequency": {
  87. "default": "Frequency"
  88. },
  89. "Regions": {
  90. "default": "Region(s)"
  91. },
  92. "MemorySize": {
  93. "default": "Memory size"
  94. },
  95. "SendAnonymousData": {
  96. "default": "Send anonymous usage data"
  97. }
  98. }
  99. }
  100. },
  101. "Parameters": {
  102. "SchedulingActive": {
  103. "Type": "String",
  104. "Default": "Yes",
  105. "AllowedValues": [
  106. "Yes",
  107. "No"
  108. ],
  109. "Description": "Activate or deactivate scheduling."
  110. },
  111. "ScheduledServices": {
  112. "Type": "String",
  113. "Default": "EC2",
  114. "AllowedValues": [
  115. "EC2",
  116. "RDS",
  117. "Both"
  118. ],
  119. "Description": "Scheduled Services."
  120. },
  121. "ScheduleRdsClusters": {
  122. "Type": "String",
  123. "Default": "No",
  124. "AllowedValues": [
  125. "Yes",
  126. "No"
  127. ],
  128. "Description": "Enable scheduling of Aurora clusters for RDS Service."
  129. },
  130. "CreateRdsSnapshot": {
  131. "Type": "String",
  132. "Default": "No",
  133. "AllowedValues": [
  134. "Yes",
  135. "No"
  136. ],
  137. "Description": "Create snapshot before stopping RDS instances(does not apply to Aurora Clusters)."
  138. },
  139. "MemorySize": {
  140. "Type": "Number",
  141. "Default": 128,
  142. "AllowedValues": [
  143. "128",
  144. "384",
  145. "512",
  146. "640",
  147. "768",
  148. "896",
  149. "1024",
  150. "1152",
  151. "1280",
  152. "1408",
  153. "1536"
  154. ],
  155. "Description": "Size of the Lambda function running the scheduler, increase size when processing large numbers of instances."
  156. },
  157. "UseCloudWatchMetrics": {
  158. "Type": "String",
  159. "Default": "No",
  160. "AllowedValues": [
  161. "Yes",
  162. "No"
  163. ],
  164. "Description": "Collect instance scheduling data using CloudWatch metrics."
  165. },
  166. "LogRetentionDays": {
  167. "Type": "Number",
  168. "Default": 30,
  169. "AllowedValues": [
  170. "1",
  171. "3",
  172. "5",
  173. "7",
  174. "14",
  175. "14",
  176. "30",
  177. "60",
  178. "90",
  179. "120",
  180. "150",
  181. "180",
  182. "365",
  183. "400",
  184. "545",
  185. "731",
  186. "1827",
  187. "3653"
  188. ],
  189. "Description": "Retention days for scheduler logs."
  190. },
  191. "Trace": {
  192. "Type": "String",
  193. "Default": "No",
  194. "AllowedValues": [
  195. "Yes",
  196. "No"
  197. ],
  198. "Description": "Enable logging of detailed informtion in CloudWatch logs."
  199. },
  200. "TagName": {
  201. "Type": "String",
  202. "Default": "Schedule",
  203. "Description": "Name of tag to use for associating instance schedule schemas with service instances.",
  204. "MaxLength": 127,
  205. "MinLength": 1
  206. },
  207. "DefaultTimezone": {
  208. "Type": "String",
  209. "Default": "UTC",
  210. "AllowedValues": [
  211. "Africa/Abidjan",
  212. "Africa/Accra",
  213. "Africa/Addis_Ababa",
  214. "Africa/Algiers",
  215. "Africa/Asmara",
  216. "Africa/Bamako",
  217. "Africa/Bangui",
  218. "Africa/Banjul",
  219. "Africa/Bissau",
  220. "Africa/Blantyre",
  221. "Africa/Brazzaville",
  222. "Africa/Bujumbura",
  223. "Africa/Cairo",
  224. "Africa/Casablanca",
  225. "Africa/Ceuta",
  226. "Africa/Conakry",
  227. "Africa/Dakar",
  228. "Africa/Dar_es_Salaam",
  229. "Africa/Djibouti",
  230. "Africa/Douala",
  231. "Africa/El_Aaiun",
  232. "Africa/Freetown",
  233. "Africa/Gaborone",
  234. "Africa/Harare",
  235. "Africa/Johannesburg",
  236. "Africa/Juba",
  237. "Africa/Kampala",
  238. "Africa/Khartoum",
  239. "Africa/Kigali",
  240. "Africa/Kinshasa",
  241. "Africa/Lagos",
  242. "Africa/Libreville",
  243. "Africa/Lome",
  244. "Africa/Luanda",
  245. "Africa/Lubumbashi",
  246. "Africa/Lusaka",
  247. "Africa/Malabo",
  248. "Africa/Maputo",
  249. "Africa/Maseru",
  250. "Africa/Mbabane",
  251. "Africa/Mogadishu",
  252. "Africa/Monrovia",
  253. "Africa/Nairobi",
  254. "Africa/Ndjamena",
  255. "Africa/Niamey",
  256. "Africa/Nouakchott",
  257. "Africa/Ouagadougou",
  258. "Africa/Porto-Novo",
  259. "Africa/Sao_Tome",
  260. "Africa/Tripoli",
  261. "Africa/Tunis",
  262. "Africa/Windhoek",
  263. "America/Adak",
  264. "America/Anchorage",
  265. "America/Anguilla",
  266. "America/Antigua",
  267. "America/Araguaina",
  268. "America/Argentina/Buenos_Aires",
  269. "America/Argentina/Catamarca",
  270. "America/Argentina/Cordoba",
  271. "America/Argentina/Jujuy",
  272. "America/Argentina/La_Rioja",
  273. "America/Argentina/Mendoza",
  274. "America/Argentina/Rio_Gallegos",
  275. "America/Argentina/Salta",
  276. "America/Argentina/San_Juan",
  277. "America/Argentina/San_Luis",
  278. "America/Argentina/Tucuman",
  279. "America/Argentina/Ushuaia",
  280. "America/Aruba",
  281. "America/Asuncion",
  282. "America/Atikokan",
  283. "America/Bahia",
  284. "America/Bahia_Banderas",
  285. "America/Barbados",
  286. "America/Belem",
  287. "America/Belize",
  288. "America/Blanc-Sablon",
  289. "America/Boa_Vista",
  290. "America/Bogota",
  291. "America/Boise",
  292. "America/Cambridge_Bay",
  293. "America/Campo_Grande",
  294. "America/Cancun",
  295. "America/Caracas",
  296. "America/Cayenne",
  297. "America/Cayman",
  298. "America/Chicago",
  299. "America/Chihuahua",
  300. "America/Costa_Rica",
  301. "America/Creston",
  302. "America/Cuiaba",
  303. "America/Curacao",
  304. "America/Danmarkshavn",
  305. "America/Dawson",
  306. "America/Dawson_Creek",
  307. "America/Denver",
  308. "America/Detroit",
  309. "America/Dominica",
  310. "America/Edmonton",
  311. "America/Eirunepe",
  312. "America/El_Salvador",
  313. "America/Fortaleza",
  314. "America/Glace_Bay",
  315. "America/Godthab",
  316. "America/Goose_Bay",
  317. "America/Grand_Turk",
  318. "America/Grenada",
  319. "America/Guadeloupe",
  320. "America/Guatemala",
  321. "America/Guayaquil",
  322. "America/Guyana",
  323. "America/Halifax",
  324. "America/Havana",
  325. "America/Hermosillo",
  326. "America/Indiana/Indianapolis",
  327. "America/Indiana/Knox",
  328. "America/Indiana/Marengo",
  329. "America/Indiana/Petersburg",
  330. "America/Indiana/Tell_City",
  331. "America/Indiana/Vevay",
  332. "America/Indiana/Vincennes",
  333. "America/Indiana/Winamac",
  334. "America/Inuvik",
  335. "America/Iqaluit",
  336. "America/Jamaica",
  337. "America/Juneau",
  338. "America/Kentucky/Louisville",
  339. "America/Kentucky/Monticello",
  340. "America/Kralendijk",
  341. "America/La_Paz",
  342. "America/Lima",
  343. "America/Los_Angeles",
  344. "America/Lower_Princes",
  345. "America/Maceio",
  346. "America/Managua",
  347. "America/Manaus",
  348. "America/Marigot",
  349. "America/Martinique",
  350. "America/Matamoros",
  351. "America/Mazatlan",
  352. "America/Menominee",
  353. "America/Merida",
  354. "America/Metlakatla",
  355. "America/Mexico_City",
  356. "America/Miquelon",
  357. "America/Moncton",
  358. "America/Monterrey",
  359. "America/Montevideo",
  360. "America/Montreal",
  361. "America/Montserrat",
  362. "America/Nassau",
  363. "America/New_York",
  364. "America/Nipigon",
  365. "America/Nome",
  366. "America/Noronha",
  367. "America/North_Dakota/Beulah",
  368. "America/North_Dakota/Center",
  369. "America/North_Dakota/New_Salem",
  370. "America/Ojinaga",
  371. "America/Panama",
  372. "America/Pangnirtung",
  373. "America/Paramaribo",
  374. "America/Phoenix",
  375. "America/Port-au-Prince",
  376. "America/Port_of_Spain",
  377. "America/Porto_Velho",
  378. "America/Puerto_Rico",
  379. "America/Rainy_River",
  380. "America/Rankin_Inlet",
  381. "America/Recife",
  382. "America/Regina",
  383. "America/Resolute",
  384. "America/Rio_Branco",
  385. "America/Santa_Isabel",
  386. "America/Santarem",
  387. "America/Santiago",
  388. "America/Santo_Domingo",
  389. "America/Sao_Paulo",
  390. "America/Scoresbysund",
  391. "America/Sitka",
  392. "America/St_Barthelemy",
  393. "America/St_Johns",
  394. "America/St_Kitts",
  395. "America/St_Lucia",
  396. "America/St_Thomas",
  397. "America/St_Vincent",
  398. "America/Swift_Current",
  399. "America/Tegucigalpa",
  400. "America/Thule",
  401. "America/Thunder_Bay",
  402. "America/Tijuana",
  403. "America/Toronto",
  404. "America/Tortola",
  405. "America/Vancouver",
  406. "America/Whitehorse",
  407. "America/Winnipeg",
  408. "America/Yakutat",
  409. "America/Yellowknife",
  410. "Antarctica/Casey",
  411. "Antarctica/Davis",
  412. "Antarctica/DumontDUrville",
  413. "Antarctica/Macquarie",
  414. "Antarctica/Mawson",
  415. "Antarctica/McMurdo",
  416. "Antarctica/Palmer",
  417. "Antarctica/Rothera",
  418. "Antarctica/Syowa",
  419. "Antarctica/Vostok",
  420. "Arctic/Longyearbyen",
  421. "Asia/Aden",
  422. "Asia/Almaty",
  423. "Asia/Amman",
  424. "Asia/Anadyr",
  425. "Asia/Aqtau",
  426. "Asia/Aqtobe",
  427. "Asia/Ashgabat",
  428. "Asia/Baghdad",
  429. "Asia/Bahrain",
  430. "Asia/Baku",
  431. "Asia/Bangkok",
  432. "Asia/Beirut",
  433. "Asia/Bishkek",
  434. "Asia/Brunei",
  435. "Asia/Choibalsan",
  436. "Asia/Chongqing",
  437. "Asia/Colombo",
  438. "Asia/Damascus",
  439. "Asia/Dhaka",
  440. "Asia/Dili",
  441. "Asia/Dubai",
  442. "Asia/Dushanbe",
  443. "Asia/Gaza",
  444. "Asia/Harbin",
  445. "Asia/Hebron",
  446. "Asia/Ho_Chi_Minh",
  447. "Asia/Hong_Kong",
  448. "Asia/Hovd",
  449. "Asia/Irkutsk",
  450. "Asia/Jakarta",
  451. "Asia/Jayapura",
  452. "Asia/Jerusalem",
  453. "Asia/Kabul",
  454. "Asia/Kamchatka",
  455. "Asia/Karachi",
  456. "Asia/Kashgar",
  457. "Asia/Kathmandu",
  458. "Asia/Khandyga",
  459. "Asia/Kolkata",
  460. "Asia/Krasnoyarsk",
  461. "Asia/Kuala_Lumpur",
  462. "Asia/Kuching",
  463. "Asia/Kuwait",
  464. "Asia/Macau",
  465. "Asia/Magadan",
  466. "Asia/Makassar",
  467. "Asia/Manila",
  468. "Asia/Muscat",
  469. "Asia/Nicosia",
  470. "Asia/Novokuznetsk",
  471. "Asia/Novosibirsk",
  472. "Asia/Omsk",
  473. "Asia/Oral",
  474. "Asia/Phnom_Penh",
  475. "Asia/Pontianak",
  476. "Asia/Pyongyang",
  477. "Asia/Qatar",
  478. "Asia/Qyzylorda",
  479. "Asia/Rangoon",
  480. "Asia/Riyadh",
  481. "Asia/Sakhalin",
  482. "Asia/Samarkand",
  483. "Asia/Seoul",
  484. "Asia/Shanghai",
  485. "Asia/Singapore",
  486. "Asia/Taipei",
  487. "Asia/Tashkent",
  488. "Asia/Tbilisi",
  489. "Asia/Tehran",
  490. "Asia/Thimphu",
  491. "Asia/Tokyo",
  492. "Asia/Ulaanbaatar",
  493. "Asia/Urumqi",
  494. "Asia/Ust-Nera",
  495. "Asia/Vientiane",
  496. "Asia/Vladivostok",
  497. "Asia/Yakutsk",
  498. "Asia/Yekaterinburg",
  499. "Asia/Yerevan",
  500. "Atlantic/Azores",
  501. "Atlantic/Bermuda",
  502. "Atlantic/Canary",
  503. "Atlantic/Cape_Verde",
  504. "Atlantic/Faroe",
  505. "Atlantic/Madeira",
  506. "Atlantic/Reykjavik",
  507. "Atlantic/South_Georgia",
  508. "Atlantic/St_Helena",
  509. "Atlantic/Stanley",
  510. "Australia/Adelaide",
  511. "Australia/Brisbane",
  512. "Australia/Broken_Hill",
  513. "Australia/Currie",
  514. "Australia/Darwin",
  515. "Australia/Eucla",
  516. "Australia/Hobart",
  517. "Australia/Lindeman",
  518. "Australia/Lord_Howe",
  519. "Australia/Melbourne",
  520. "Australia/Perth",
  521. "Australia/Sydney",
  522. "Canada/Atlantic",
  523. "Canada/Central",
  524. "Canada/Eastern",
  525. "Canada/Mountain",
  526. "Canada/Newfoundland",
  527. "Canada/Pacific",
  528. "Europe/Amsterdam",
  529. "Europe/Andorra",
  530. "Europe/Athens",
  531. "Europe/Belgrade",
  532. "Europe/Berlin",
  533. "Europe/Bratislava",
  534. "Europe/Brussels",
  535. "Europe/Bucharest",
  536. "Europe/Budapest",
  537. "Europe/Busingen",
  538. "Europe/Chisinau",
  539. "Europe/Copenhagen",
  540. "Europe/Dublin",
  541. "Europe/Gibraltar",
  542. "Europe/Guernsey",
  543. "Europe/Helsinki",
  544. "Europe/Isle_of_Man",
  545. "Europe/Istanbul",
  546. "Europe/Jersey",
  547. "Europe/Kaliningrad",
  548. "Europe/Kiev",
  549. "Europe/Lisbon",
  550. "Europe/Ljubljana",
  551. "Europe/London",
  552. "Europe/Luxembourg",
  553. "Europe/Madrid",
  554. "Europe/Malta",
  555. "Europe/Mariehamn",
  556. "Europe/Minsk",
  557. "Europe/Monaco",
  558. "Europe/Moscow",
  559. "Europe/Oslo",
  560. "Europe/Paris",
  561. "Europe/Podgorica",
  562. "Europe/Prague",
  563. "Europe/Riga",
  564. "Europe/Rome",
  565. "Europe/Samara",
  566. "Europe/San_Marino",
  567. "Europe/Sarajevo",
  568. "Europe/Simferopol",
  569. "Europe/Skopje",
  570. "Europe/Sofia",
  571. "Europe/Stockholm",
  572. "Europe/Tallinn",
  573. "Europe/Tirane",
  574. "Europe/Uzhgorod",
  575. "Europe/Vaduz",
  576. "Europe/Vatican",
  577. "Europe/Vienna",
  578. "Europe/Vilnius",
  579. "Europe/Volgograd",
  580. "Europe/Warsaw",
  581. "Europe/Zagreb",
  582. "Europe/Zaporozhye",
  583. "Europe/Zurich",
  584. "GMT",
  585. "Indian/Antananarivo",
  586. "Indian/Chagos",
  587. "Indian/Christmas",
  588. "Indian/Cocos",
  589. "Indian/Comoro",
  590. "Indian/Kerguelen",
  591. "Indian/Mahe",
  592. "Indian/Maldives",
  593. "Indian/Mauritius",
  594. "Indian/Mayotte",
  595. "Indian/Reunion",
  596. "Pacific/Apia",
  597. "Pacific/Auckland",
  598. "Pacific/Chatham",
  599. "Pacific/Chuuk",
  600. "Pacific/Easter",
  601. "Pacific/Efate",
  602. "Pacific/Enderbury",
  603. "Pacific/Fakaofo",
  604. "Pacific/Fiji",
  605. "Pacific/Funafuti",
  606. "Pacific/Galapagos",
  607. "Pacific/Gambier",
  608. "Pacific/Guadalcanal",
  609. "Pacific/Guam",
  610. "Pacific/Honolulu",
  611. "Pacific/Johnston",
  612. "Pacific/Kiritimati",
  613. "Pacific/Kosrae",
  614. "Pacific/Kwajalein",
  615. "Pacific/Majuro",
  616. "Pacific/Marquesas",
  617. "Pacific/Midway",
  618. "Pacific/Nauru",
  619. "Pacific/Niue",
  620. "Pacific/Norfolk",
  621. "Pacific/Noumea",
  622. "Pacific/Pago_Pago",
  623. "Pacific/Palau",
  624. "Pacific/Pitcairn",
  625. "Pacific/Pohnpei",
  626. "Pacific/Port_Moresby",
  627. "Pacific/Rarotonga",
  628. "Pacific/Saipan",
  629. "Pacific/Tahiti",
  630. "Pacific/Tarawa",
  631. "Pacific/Tongatapu",
  632. "Pacific/Wake",
  633. "Pacific/Wallis",
  634. "US/Alaska",
  635. "US/Arizona",
  636. "US/Central",
  637. "US/Eastern",
  638. "US/Hawaii",
  639. "US/Mountain",
  640. "US/Pacific",
  641. "UTC"
  642. ],
  643. "Description": "Choose the default Time Zone. Default is 'UTC'"
  644. },
  645. "Regions": {
  646. "Type": "CommaDelimitedList",
  647. "Description": "List of regions in which instances are scheduled, leave blank for current region only."
  648. },
  649. "CrossAccountRoles": {
  650. "Type": "CommaDelimitedList",
  651. "Description": "Comma separated list of ARN's for cross account access roles. These roles must be created in all checked accounts the scheduler to start and stop instances."
  652. },
  653. "StartedTags": {
  654. "Type": "String",
  655. "Description": "Comma separated list of tagname and values on the formt name=value,name=value,.. that are set on started instances"
  656. },
  657. "StoppedTags": {
  658. "Type": "String",
  659. "Description": "Comma separated list of tagname and values on the formt name=value,name=value,.. that are set on stopped instances"
  660. },
  661. "SchedulerFrequency": {
  662. "Type": "String",
  663. "Default": "5",
  664. "AllowedValues": [
  665. "1",
  666. "2",
  667. "5",
  668. "10",
  669. "15",
  670. "30",
  671. "60"
  672. ],
  673. "Description": "Scheduler running frequency in minutes."
  674. },
  675. "ScheduleLambdaAccount": {
  676. "Type": "String",
  677. "Default": "Yes",
  678. "AllowedValues": [
  679. "Yes",
  680. "No"
  681. ],
  682. "Description": "Schedule instances in this account."
  683. },
  684. "SendAnonymousData": {
  685. "Type": "String",
  686. "Default": "Yes",
  687. "AllowedValues": [
  688. "Yes",
  689. "No"
  690. ],
  691. "Description": "Send Anonymous Metrics Data."
  692. }
  693. },
  694. "Mappings": {
  695. "mappings": {
  696. "TrueFalse": {
  697. "Yes": "True",
  698. "No": "False"
  699. },
  700. "EnabledDisabled": {
  701. "Yes": "ENABLED",
  702. "No": "DISABLED"
  703. },
  704. "Services": {
  705. "EC2": "ec2",
  706. "RDS": "rds",
  707. "Both": "ec2,rds"
  708. },
  709. "Timeouts": {
  710. "1": "cron(0/1 * * * ? *)",
  711. "2": "cron(0/2 * * * ? *)",
  712. "5": "cron(0/5 * * * ? *)",
  713. "10": "cron(0/10 * * * ? *)",
  714. "15": "cron(0/15 * * * ? *)",
  715. "30": "cron(0/30 * * * ? *)",
  716. "60": "cron(0 0/1 * * ? *)"
  717. },
  718. "Settings": {
  719. "MetricsUrl": "https://metrics.awssolutionsbuilder.com/generic",
  720. "MetricsSolutionId": "S00030"
  721. }
  722. }
  723. },
  724. "Resources": {
  725. "SchedulerLogGroup": {
  726. "Type": "AWS::Logs::LogGroup",
  727. "Properties": {
  728. "LogGroupName": {
  729. "Fn::Join": [
  730. "",
  731. [
  732. {
  733. "Ref": "AWS::StackName"
  734. },
  735. "-logs"
  736. ]
  737. ]
  738. },
  739. "RetentionInDays": {
  740. "Ref": "LogRetentionDays"
  741. }
  742. },
  743. "UpdateReplacePolicy": "Delete",
  744. "DeletionPolicy": "Delete",
  745. "Metadata": {
  746. "aws:cdk:path": "instance-scheduler/SchedulerLogGroup/Resource"
  747. }
  748. },
  749. "SchedulerRole": {
  750. "Type": "AWS::IAM::Role",
  751. "Properties": {
  752. "AssumeRolePolicyDocument": {
  753. "Statement": [
  754. {
  755. "Action": "sts:AssumeRole",
  756. "Effect": "Allow",
  757. "Principal": {
  758. "Service": [
  759. "events.amazonaws.com",
  760. "lambda.amazonaws.com"
  761. ]
  762. }
  763. }
  764. ],
  765. "Version": "2012-10-17"
  766. },
  767. "Path": "/aws_services/"
  768. },
  769. "Metadata": {
  770. "aws:cdk:path": "instance-scheduler/SchedulerRole/Resource"
  771. }
  772. },
  773. "SchedulerRoleDefaultPolicy66F774B8": {
  774. "Type": "AWS::IAM::Policy",
  775. "Properties": {
  776. "PolicyDocument": {
  777. "Statement": [
  778. {
  779. "Action": [
  780. "dynamodb:BatchGetItem",
  781. "dynamodb:GetRecords",
  782. "dynamodb:GetShardIterator",
  783. "dynamodb:Query",
  784. "dynamodb:GetItem",
  785. "dynamodb:Scan",
  786. "dynamodb:BatchWriteItem",
  787. "dynamodb:PutItem",
  788. "dynamodb:UpdateItem",
  789. "dynamodb:DeleteItem"
  790. ],
  791. "Effect": "Allow",
  792. "Resource": [
  793. {
  794. "Fn::GetAtt": [
  795. "StateTable",
  796. "Arn"
  797. ]
  798. },
  799. {
  800. "Ref": "AWS::NoValue"
  801. }
  802. ]
  803. },
  804. {
  805. "Action": [
  806. "dynamodb:DeleteItem",
  807. "dynamodb:GetItem",
  808. "dynamodb:PutItem",
  809. "dynamodb:Query",
  810. "dynamodb:Scan",
  811. "dynamodb:BatchWriteItem"
  812. ],
  813. "Effect": "Allow",
  814. "Resource": [
  815. {
  816. "Fn::GetAtt": [
  817. "ConfigTable",
  818. "Arn"
  819. ]
  820. },
  821. {
  822. "Fn::GetAtt": [
  823. "MaintenanceWindowTable",
  824. "Arn"
  825. ]
  826. }
  827. ]
  828. }
  829. ],
  830. "Version": "2012-10-17"
  831. },
  832. "PolicyName": "SchedulerRoleDefaultPolicy66F774B8",
  833. "Roles": [
  834. {
  835. "Ref": "SchedulerRole"
  836. }
  837. ]
  838. },
  839. "Metadata": {
  840. "aws:cdk:path": "instance-scheduler/SchedulerRole/DefaultPolicy/Resource"
  841. }
  842. },
  843. "InstanceSchedulerEncryptionKey": {
  844. "Type": "AWS::KMS::Key",
  845. "Properties": {
  846. "KeyPolicy": {
  847. "Statement": [
  848. {
  849. "Action": "kms:*",
  850. "Effect": "Allow",
  851. "Principal": {
  852. "AWS": {
  853. "Fn::Join": [
  854. "",
  855. [
  856. "arn:",
  857. {
  858. "Ref": "AWS::Partition"
  859. },
  860. ":iam::",
  861. {
  862. "Ref": "AWS::AccountId"
  863. },
  864. ":root"
  865. ]
  866. ]
  867. }
  868. },
  869. "Resource": "*",
  870. "Sid": "default"
  871. },
  872. {
  873. "Action": [
  874. "kms:GenerateDataKey*",
  875. "kms:Decrypt"
  876. ],
  877. "Effect": "Allow",
  878. "Principal": {
  879. "AWS": {
  880. "Fn::GetAtt": [
  881. "SchedulerRole",
  882. "Arn"
  883. ]
  884. }
  885. },
  886. "Resource": "*",
  887. "Sid": "Allows use of key"
  888. },
  889. {
  890. "Action": [
  891. "kms:Create*",
  892. "kms:Describe*",
  893. "kms:Enable*",
  894. "kms:List*",
  895. "kms:Put*",
  896. "kms:Update*",
  897. "kms:Revoke*",
  898. "kms:Disable*",
  899. "kms:Get*",
  900. "kms:Delete*",
  901. "kms:ScheduleKeyDeletion",
  902. "kms:CancelKeyDeletion",
  903. "kms:GenerateDataKey",
  904. "kms:TagResource",
  905. "kms:UntagResource"
  906. ],
  907. "Effect": "Allow",
  908. "Principal": {
  909. "AWS": {
  910. "Fn::Join": [
  911. "",
  912. [
  913. "arn:",
  914. {
  915. "Ref": "AWS::Partition"
  916. },
  917. ":iam::",
  918. {
  919. "Ref": "AWS::AccountId"
  920. },
  921. ":root"
  922. ]
  923. ]
  924. }
  925. },
  926. "Resource": "*"
  927. }
  928. ],
  929. "Version": "2012-10-17"
  930. },
  931. "Description": "Key for SNS",
  932. "Enabled": true,
  933. "EnableKeyRotation": true
  934. },
  935. "UpdateReplacePolicy": "Delete",
  936. "DeletionPolicy": "Delete",
  937. "Metadata": {
  938. "aws:cdk:path": "instance-scheduler/InstanceSchedulerEncryptionKey/Resource"
  939. }
  940. },
  941. "InstanceSchedulerEncryptionKeyAlias": {
  942. "Type": "AWS::KMS::Alias",
  943. "Properties": {
  944. "AliasName": "alias/instance-scheduler-encryption-key",
  945. "TargetKeyId": {
  946. "Fn::GetAtt": [
  947. "InstanceSchedulerEncryptionKey",
  948. "Arn"
  949. ]
  950. }
  951. },
  952. "Metadata": {
  953. "aws:cdk:path": "instance-scheduler/InstanceSchedulerEncryptionKeyAlias/Resource"
  954. }
  955. },
  956. "InstanceSchedulerSnsTopic": {
  957. "Type": "AWS::SNS::Topic",
  958. "Properties": {
  959. "DisplayName": {
  960. "Ref": "AWS::StackName"
  961. },
  962. "KmsMasterKeyId": {
  963. "Ref": "InstanceSchedulerEncryptionKey"
  964. }
  965. },
  966. "Metadata": {
  967. "aws:cdk:path": "instance-scheduler/InstanceSchedulerSnsTopic/Resource"
  968. }
  969. },
  970. "instanceschedulerlambdaLambdaFunctionServiceRoleEBF44CD1": {
  971. "Type": "AWS::IAM::Role",
  972. "Properties": {
  973. "AssumeRolePolicyDocument": {
  974. "Statement": [
  975. {
  976. "Action": "sts:AssumeRole",
  977. "Effect": "Allow",
  978. "Principal": {
  979. "Service": "lambda.amazonaws.com"
  980. }
  981. }
  982. ],
  983. "Version": "2012-10-17"
  984. },
  985. "Policies": [
  986. {
  987. "PolicyDocument": {
  988. "Statement": [
  989. {
  990. "Action": [
  991. "logs:CreateLogGroup",
  992. "logs:CreateLogStream",
  993. "logs:PutLogEvents"
  994. ],
  995. "Effect": "Allow",
  996. "Resource": {
  997. "Fn::Join": [
  998. "",
  999. [
  1000. "arn:aws-us-gov:logs:",
  1001. {
  1002. "Ref": "AWS::Region"
  1003. },
  1004. ":",
  1005. {
  1006. "Ref": "AWS::AccountId"
  1007. },
  1008. ":log-group:/aws/lambda/*"
  1009. ]
  1010. ]
  1011. }
  1012. }
  1013. ],
  1014. "Version": "2012-10-17"
  1015. },
  1016. "PolicyName": "LambdaFunctionServiceRolePolicy"
  1017. }
  1018. ],
  1019. "Path": "/aws_services/"
  1020. },
  1021. "Metadata": {
  1022. "aws:cdk:path": "instance-scheduler/instance-scheduler-lambda/LambdaFunctionServiceRole/Resource"
  1023. }
  1024. },
  1025. "Main": {
  1026. "Type": "AWS::Lambda::Function",
  1027. "Properties": {
  1028. "Code": {
  1029. "S3Bucket": "afsxdr-binaries",
  1030. "S3Key": "aws-instance-scheduler/v1.3.3/instance-scheduler.aws-us-gov.zip"
  1031. },
  1032. "Handler": "main.lambda_handler",
  1033. "Role": {
  1034. "Fn::GetAtt": [
  1035. "SchedulerRole",
  1036. "Arn"
  1037. ]
  1038. },
  1039. "Runtime": "python3.7",
  1040. "Description": "EC2 and RDS instance scheduler, version v1.3.3",
  1041. "Environment": {
  1042. "Variables": {
  1043. "SCHEDULER_FREQUENCY": {
  1044. "Ref": "SchedulerFrequency"
  1045. },
  1046. "TAG_NAME": {
  1047. "Ref": "TagName"
  1048. },
  1049. "LOG_GROUP": {
  1050. "Ref": "SchedulerLogGroup"
  1051. },
  1052. "ACCOUNT": {
  1053. "Ref": "AWS::AccountId"
  1054. },
  1055. "ISSUES_TOPIC_ARN": {
  1056. "Ref": "InstanceSchedulerSnsTopic"
  1057. },
  1058. "STACK_NAME": {
  1059. "Ref": "AWS::StackName"
  1060. },
  1061. "BOTO_RETRY": "5,10,30,0.25",
  1062. "ENV_BOTO_RETRY_LOGGING": "FALSE",
  1063. "SEND_METRICS": {
  1064. "Fn::FindInMap": [
  1065. "mappings",
  1066. "TrueFalse",
  1067. {
  1068. "Ref": "SendAnonymousData"
  1069. }
  1070. ]
  1071. },
  1072. "SOLUTION_ID": {
  1073. "Fn::FindInMap": [
  1074. "mappings",
  1075. "Settings",
  1076. "MetricsSolutionId"
  1077. ]
  1078. },
  1079. "TRACE": {
  1080. "Fn::FindInMap": [
  1081. "mappings",
  1082. "TrueFalse",
  1083. {
  1084. "Ref": "Trace"
  1085. }
  1086. ]
  1087. },
  1088. "USER_AGENT": {
  1089. "Fn::Join": [
  1090. "",
  1091. [
  1092. "InstanceScheduler-",
  1093. {
  1094. "Ref": "AWS::StackName"
  1095. },
  1096. "-v1.3.3"
  1097. ]
  1098. ]
  1099. },
  1100. "METRICS_URL": {
  1101. "Fn::FindInMap": [
  1102. "mappings",
  1103. "Settings",
  1104. "MetricsUrl"
  1105. ]
  1106. },
  1107. "SCHEDULER_RULE": "aws-instance-schedulerscheduling_rule",
  1108. "DDB_TABLE_NAME": {
  1109. "Ref": "StateTable"
  1110. },
  1111. "CONFIG_TABLE": {
  1112. "Ref": "ConfigTable"
  1113. },
  1114. "MAINTENANCE_WINDOW_TABLE": {
  1115. "Ref": "MaintenanceWindowTable"
  1116. },
  1117. "STATE_TABLE": {
  1118. "Ref": "StateTable"
  1119. }
  1120. }
  1121. },
  1122. "FunctionName": {
  1123. "Fn::Join": [
  1124. "",
  1125. [
  1126. {
  1127. "Ref": "AWS::StackName"
  1128. },
  1129. "-InstanceSchedulerMain"
  1130. ]
  1131. ]
  1132. },
  1133. "MemorySize": {
  1134. "Ref": "MemorySize"
  1135. },
  1136. "Timeout": 300
  1137. },
  1138. "DependsOn": [
  1139. "EC2DynamoDBPolicy",
  1140. "SchedulerPolicy",
  1141. "SchedulerRoleDefaultPolicy66F774B8",
  1142. "SchedulerRole"
  1143. ],
  1144. "Metadata": {
  1145. "cfn_nag": {
  1146. "rules_to_suppress": [
  1147. {
  1148. "id": "W58",
  1149. "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with more tighter permissions."
  1150. }
  1151. ]
  1152. }
  1153. }
  1154. },
  1155. "instanceschedulerlambdaLambdaFunctionLambdaInvokePermissionB1734834": {
  1156. "Type": "AWS::Lambda::Permission",
  1157. "Properties": {
  1158. "Action": "lambda:InvokeFunction",
  1159. "FunctionName": {
  1160. "Fn::GetAtt": [
  1161. "Main",
  1162. "Arn"
  1163. ]
  1164. },
  1165. "Principal": "events.amazonaws.com",
  1166. "SourceArn": {
  1167. "Fn::GetAtt": [
  1168. "SchedulerRule",
  1169. "Arn"
  1170. ]
  1171. }
  1172. },
  1173. "Metadata": {
  1174. "aws:cdk:path": "instance-scheduler/instance-scheduler-lambda/LambdaFunction/LambdaInvokePermission"
  1175. }
  1176. },
  1177. "StateTable": {
  1178. "Type": "AWS::DynamoDB::Table",
  1179. "Properties": {
  1180. "KeySchema": [
  1181. {
  1182. "AttributeName": "service",
  1183. "KeyType": "HASH"
  1184. },
  1185. {
  1186. "AttributeName": "account-region",
  1187. "KeyType": "RANGE"
  1188. }
  1189. ],
  1190. "AttributeDefinitions": [
  1191. {
  1192. "AttributeName": "service",
  1193. "AttributeType": "S"
  1194. },
  1195. {
  1196. "AttributeName": "account-region",
  1197. "AttributeType": "S"
  1198. }
  1199. ],
  1200. "BillingMode": "PAY_PER_REQUEST",
  1201. "SSESpecification": {
  1202. "KMSMasterKeyId": {
  1203. "Ref": "InstanceSchedulerEncryptionKey"
  1204. },
  1205. "SSEEnabled": true,
  1206. "SSEType": "KMS"
  1207. }
  1208. },
  1209. "UpdateReplacePolicy": "Delete",
  1210. "DeletionPolicy": "Delete",
  1211. "Metadata": {
  1212. "aws:cdk:path": "instance-scheduler/instance-scheduler-lambda/DynamoTable/Resource"
  1213. }
  1214. },
  1215. "ConfigTable": {
  1216. "Type": "AWS::DynamoDB::Table",
  1217. "Properties": {
  1218. "KeySchema": [
  1219. {
  1220. "AttributeName": "type",
  1221. "KeyType": "HASH"
  1222. },
  1223. {
  1224. "AttributeName": "name",
  1225. "KeyType": "RANGE"
  1226. }
  1227. ],
  1228. "AttributeDefinitions": [
  1229. {
  1230. "AttributeName": "type",
  1231. "AttributeType": "S"
  1232. },
  1233. {
  1234. "AttributeName": "name",
  1235. "AttributeType": "S"
  1236. }
  1237. ],
  1238. "BillingMode": "PAY_PER_REQUEST",
  1239. "SSESpecification": {
  1240. "KMSMasterKeyId": {
  1241. "Ref": "InstanceSchedulerEncryptionKey"
  1242. },
  1243. "SSEEnabled": true,
  1244. "SSEType": "KMS"
  1245. }
  1246. },
  1247. "UpdateReplacePolicy": "Delete",
  1248. "DeletionPolicy": "Delete",
  1249. "Metadata": {
  1250. "aws:cdk:path": "instance-scheduler/ConfigTable/Resource"
  1251. }
  1252. },
  1253. "MaintenanceWindowTable": {
  1254. "Type": "AWS::DynamoDB::Table",
  1255. "Properties": {
  1256. "KeySchema": [
  1257. {
  1258. "AttributeName": "Name",
  1259. "KeyType": "HASH"
  1260. }
  1261. ],
  1262. "AttributeDefinitions": [
  1263. {
  1264. "AttributeName": "Name",
  1265. "AttributeType": "S"
  1266. }
  1267. ],
  1268. "BillingMode": "PAY_PER_REQUEST",
  1269. "SSESpecification": {
  1270. "KMSMasterKeyId": {
  1271. "Ref": "InstanceSchedulerEncryptionKey"
  1272. },
  1273. "SSEEnabled": true,
  1274. "SSEType": "KMS"
  1275. }
  1276. },
  1277. "UpdateReplacePolicy": "Delete",
  1278. "DeletionPolicy": "Delete",
  1279. "Metadata": {
  1280. "aws:cdk:path": "instance-scheduler/MaintenanceWindowTable/Resource"
  1281. }
  1282. },
  1283. "SchedulerRule": {
  1284. "Type": "AWS::Events::Rule",
  1285. "Properties": {
  1286. "Description": "Instance Scheduler - Rule to trigger instance for scheduler function version v1.3.3",
  1287. "Name": "aws-instance-schedulerscheduling_rule",
  1288. "ScheduleExpression": {
  1289. "Fn::FindInMap": [
  1290. "mappings",
  1291. "Timeouts",
  1292. {
  1293. "Ref": "SchedulerFrequency"
  1294. }
  1295. ]
  1296. },
  1297. "State": {
  1298. "Fn::FindInMap": [
  1299. "mappings",
  1300. "EnabledDisabled",
  1301. {
  1302. "Ref": "SchedulingActive"
  1303. }
  1304. ]
  1305. },
  1306. "Targets": [
  1307. {
  1308. "Arn": {
  1309. "Fn::GetAtt": [
  1310. "Main",
  1311. "Arn"
  1312. ]
  1313. },
  1314. "Id": "Target0"
  1315. }
  1316. ]
  1317. },
  1318. "Metadata": {
  1319. "aws:cdk:path": "instance-scheduler/EventlambdaConstruct/EventsRule/Resource"
  1320. }
  1321. },
  1322. "SchedulerConfigHelper": {
  1323. "Type": "Custom::ServiceSetup",
  1324. "Properties": {
  1325. "ServiceToken": {
  1326. "Fn::GetAtt": [
  1327. "Main",
  1328. "Arn"
  1329. ]
  1330. },
  1331. "timeout": 120,
  1332. "config_table": {
  1333. "Ref": "ConfigTable"
  1334. },
  1335. "tagname": {
  1336. "Ref": "TagName"
  1337. },
  1338. "default_timezone": {
  1339. "Ref": "DefaultTimezone"
  1340. },
  1341. "use_metrics": {
  1342. "Fn::FindInMap": [
  1343. "mappings",
  1344. "TrueFalse",
  1345. {
  1346. "Ref": "UseCloudWatchMetrics"
  1347. }
  1348. ]
  1349. },
  1350. "scheduled_services": {
  1351. "Fn::Split": [
  1352. ",",
  1353. {
  1354. "Fn::FindInMap": [
  1355. "mappings",
  1356. "Services",
  1357. {
  1358. "Ref": "ScheduledServices"
  1359. }
  1360. ]
  1361. }
  1362. ]
  1363. },
  1364. "schedule_clusters": {
  1365. "Fn::FindInMap": [
  1366. "mappings",
  1367. "TrueFalse",
  1368. {
  1369. "Ref": "ScheduleRdsClusters"
  1370. }
  1371. ]
  1372. },
  1373. "create_rds_snapshot": {
  1374. "Fn::FindInMap": [
  1375. "mappings",
  1376. "TrueFalse",
  1377. {
  1378. "Ref": "CreateRdsSnapshot"
  1379. }
  1380. ]
  1381. },
  1382. "regions": {
  1383. "Ref": "Regions"
  1384. },
  1385. "cross_account_roles": {
  1386. "Ref": "CrossAccountRoles"
  1387. },
  1388. "schedule_lambda_account": {
  1389. "Fn::FindInMap": [
  1390. "mappings",
  1391. "TrueFalse",
  1392. {
  1393. "Ref": "ScheduleLambdaAccount"
  1394. }
  1395. ]
  1396. },
  1397. "trace": {
  1398. "Fn::FindInMap": [
  1399. "mappings",
  1400. "TrueFalse",
  1401. {
  1402. "Ref": "Trace"
  1403. }
  1404. ]
  1405. },
  1406. "log_retention_days": {
  1407. "Ref": "LogRetentionDays"
  1408. },
  1409. "started_tags": {
  1410. "Ref": "StartedTags"
  1411. },
  1412. "stopped_tags": {
  1413. "Ref": "StoppedTags"
  1414. },
  1415. "stack_version": "v1.3.3"
  1416. },
  1417. "DependsOn": [
  1418. "SchedulerLogGroup"
  1419. ],
  1420. "UpdateReplacePolicy": "Delete",
  1421. "DeletionPolicy": "Delete",
  1422. "Metadata": {
  1423. "aws:cdk:path": "instance-scheduler/ServiceSetup/Default"
  1424. }
  1425. },
  1426. "EC2DynamoDBPolicy": {
  1427. "Type": "AWS::IAM::Policy",
  1428. "Properties": {
  1429. "PolicyDocument": {
  1430. "Statement": [
  1431. {
  1432. "Action": "sts:AssumeRole",
  1433. "Effect": "Allow",
  1434. "Resource": "arn:aws-us-gov:iam::*:role/*EC2SchedulerCross*"
  1435. },
  1436. {
  1437. "Action": [
  1438. "ssm:GetParameter",
  1439. "ssm:GetParameters"
  1440. ],
  1441. "Effect": "Allow",
  1442. "Resource": {
  1443. "Fn::Join": [
  1444. "",
  1445. [
  1446. "arn:aws-us-gov:ssm:*:",
  1447. {
  1448. "Ref": "AWS::AccountId"
  1449. },
  1450. ":parameter/*"
  1451. ]
  1452. ]
  1453. }
  1454. },
  1455. {
  1456. "Action": [
  1457. "logs:DescribeLogStreams",
  1458. "rds:DescribeDBClusters",
  1459. "rds:DescribeDBInstances",
  1460. "ec2:DescribeInstances",
  1461. "ec2:DescribeRegions",
  1462. "ec2:ModifyInstanceAttribute",
  1463. "cloudwatch:PutMetricData",
  1464. "ssm:DescribeMaintenanceWindows",
  1465. "tag:GetResources"
  1466. ],
  1467. "Effect": "Allow",
  1468. "Resource": "*"
  1469. },
  1470. {
  1471. "Action": [
  1472. "logs:CreateLogGroup",
  1473. "logs:CreateLogStream",
  1474. "logs:PutLogEvents",
  1475. "logs:PutRetentionPolicy"
  1476. ],
  1477. "Effect": "Allow",
  1478. "Resource": [
  1479. {
  1480. "Fn::Join": [
  1481. "",
  1482. [
  1483. "arn:aws-us-gov:logs:",
  1484. {
  1485. "Ref": "AWS::Region"
  1486. },
  1487. ":",
  1488. {
  1489. "Ref": "AWS::AccountId"
  1490. },
  1491. ":log-group:/aws/lambda/*"
  1492. ]
  1493. ]
  1494. },
  1495. {
  1496. "Fn::GetAtt": [
  1497. "SchedulerLogGroup",
  1498. "Arn"
  1499. ]
  1500. }
  1501. ]
  1502. }
  1503. ],
  1504. "Version": "2012-10-17"
  1505. },
  1506. "PolicyName": "EC2DynamoDBPolicy",
  1507. "Roles": [
  1508. {
  1509. "Ref": "SchedulerRole"
  1510. }
  1511. ]
  1512. },
  1513. "Metadata": {
  1514. "cfn_nag": {
  1515. "rules_to_suppress": [
  1516. {
  1517. "id": "W12",
  1518. "reason": "All policies have been scoped to be as restrictive as possible. This solution needs to access ec2/rds resources across all regions."
  1519. }
  1520. ]
  1521. }
  1522. }
  1523. },
  1524. "SchedulerPolicy": {
  1525. "Type": "AWS::IAM::Policy",
  1526. "Properties": {
  1527. "PolicyDocument": {
  1528. "Statement": [
  1529. {
  1530. "Action": [
  1531. "rds:DeleteDBSnapshot",
  1532. "rds:DescribeDBSnapshots",
  1533. "rds:StopDBInstance"
  1534. ],
  1535. "Effect": "Allow",
  1536. "Resource": {
  1537. "Fn::Join": [
  1538. "",
  1539. [
  1540. "arn:aws-us-gov:rds:*:",
  1541. {
  1542. "Ref": "AWS::AccountId"
  1543. },
  1544. ":snapshot:*"
  1545. ]
  1546. ]
  1547. }
  1548. },
  1549. {
  1550. "Action": [
  1551. "rds:AddTagsToResource",
  1552. "rds:RemoveTagsFromResource",
  1553. "rds:DescribeDBSnapshots",
  1554. "rds:StartDBInstance",
  1555. "rds:StopDBInstance"
  1556. ],
  1557. "Effect": "Allow",
  1558. "Resource": {
  1559. "Fn::Join": [
  1560. "",
  1561. [
  1562. "arn:aws-us-gov:rds:*:",
  1563. {
  1564. "Ref": "AWS::AccountId"
  1565. },
  1566. ":db:*"
  1567. ]
  1568. ]
  1569. }
  1570. },
  1571. {
  1572. "Action": [
  1573. "ec2:StartInstances",
  1574. "ec2:StopInstances",
  1575. "ec2:CreateTags",
  1576. "ec2:DeleteTags"
  1577. ],
  1578. "Effect": "Allow",
  1579. "Resource": {
  1580. "Fn::Join": [
  1581. "",
  1582. [
  1583. "arn:aws-us-gov:ec2:*:",
  1584. {
  1585. "Ref": "AWS::AccountId"
  1586. },
  1587. ":instance/*"
  1588. ]
  1589. ]
  1590. }
  1591. },
  1592. {
  1593. "Action": "sns:Publish",
  1594. "Effect": "Allow",
  1595. "Resource": {
  1596. "Ref": "InstanceSchedulerSnsTopic"
  1597. }
  1598. },
  1599. {
  1600. "Action": "lambda:InvokeFunction",
  1601. "Effect": "Allow",
  1602. "Resource": {
  1603. "Fn::Join": [
  1604. "",
  1605. [
  1606. "arn:aws-us-gov:lambda:",
  1607. {
  1608. "Ref": "AWS::Region"
  1609. },
  1610. ":",
  1611. {
  1612. "Ref": "AWS::AccountId"
  1613. },
  1614. ":function:",
  1615. {
  1616. "Ref": "AWS::StackName"
  1617. },
  1618. "-InstanceSchedulerMain"
  1619. ]
  1620. ]
  1621. }
  1622. },
  1623. {
  1624. "Action": [
  1625. "kms:GenerateDataKey*",
  1626. "kms:Decrypt"
  1627. ],
  1628. "Effect": "Allow",
  1629. "Resource": {
  1630. "Fn::GetAtt": [
  1631. "InstanceSchedulerEncryptionKey",
  1632. "Arn"
  1633. ]
  1634. }
  1635. },
  1636. {
  1637. "Action": [
  1638. "rds:AddTagsToResource",
  1639. "rds:RemoveTagsFromResource",
  1640. "rds:StartDBCluster",
  1641. "rds:StopDBCluster"
  1642. ],
  1643. "Effect": "Allow",
  1644. "Resource": {
  1645. "Fn::Join": [
  1646. "",
  1647. [
  1648. "arn:aws-us-gov:rds:*:",
  1649. {
  1650. "Ref": "AWS::AccountId"
  1651. },
  1652. ":cluster:*"
  1653. ]
  1654. ]
  1655. }
  1656. },
  1657. {
  1658. "Effect": "Allow",
  1659. "Action": [ "kms:CreateGrant" ],
  1660. "Resource": [
  1661. {
  1662. "Fn::Join": [
  1663. ":",
  1664. [ "arn:aws-us-gov:kms", { "Ref": "AWS::Region" }, { "Ref": "AWS::AccountId" }, "key/*" ]
  1665. ]
  1666. }
  1667. ],
  1668. "Condition": {
  1669. "Bool": {
  1670. "kms:GrantIsForAWSResource": true
  1671. }
  1672. }
  1673. }
  1674. ],
  1675. "Version": "2012-10-17"
  1676. },
  1677. "PolicyName": "SchedulerPolicy",
  1678. "Roles": [
  1679. {
  1680. "Ref": "SchedulerRole"
  1681. }
  1682. ]
  1683. },
  1684. "Metadata": {
  1685. "aws:cdk:path": "instance-scheduler/SchedulerPolicy/Resource"
  1686. }
  1687. }
  1688. },
  1689. "Outputs": {
  1690. "AccountId": {
  1691. "Description": "Account to give access to when creating cross-account access role fro cross account scenario ",
  1692. "Value": {
  1693. "Ref": "AWS::AccountId"
  1694. }
  1695. },
  1696. "ConfigurationTable": {
  1697. "Description": "Name of the DynamoDB configuration table",
  1698. "Value": {
  1699. "Fn::GetAtt": [
  1700. "ConfigTable",
  1701. "Arn"
  1702. ]
  1703. }
  1704. },
  1705. "IssueSnsTopicArn": {
  1706. "Description": "Topic to subscribe to for notifications of errors and warnings",
  1707. "Value": {
  1708. "Ref": "InstanceSchedulerSnsTopic"
  1709. }
  1710. },
  1711. "SchedulerRoleArn": {
  1712. "Description": "Role for the instance scheduler lambda function",
  1713. "Value": {
  1714. "Fn::GetAtt": [
  1715. "SchedulerRole",
  1716. "Arn"
  1717. ]
  1718. }
  1719. },
  1720. "ServiceInstanceScheduleServiceToken": {
  1721. "Description": "Arn to use as ServiceToken property for custom resource type Custom::ServiceInstanceSchedule",
  1722. "Value": {
  1723. "Fn::GetAtt": [
  1724. "Main",
  1725. "Arn"
  1726. ]
  1727. }
  1728. }
  1729. }
  1730. }