instance-scheduler.template.dist 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722
  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": "/"
  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: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. },
  1020. "Metadata": {
  1021. "aws:cdk:path": "instance-scheduler/instance-scheduler-lambda/LambdaFunctionServiceRole/Resource"
  1022. }
  1023. },
  1024. "Main": {
  1025. "Type": "AWS::Lambda::Function",
  1026. "Properties": {
  1027. "Code": {
  1028. "S3Bucket": {
  1029. "Fn::Join": [
  1030. "",
  1031. [
  1032. "solutions-",
  1033. {
  1034. "Ref": "AWS::Region"
  1035. }
  1036. ]
  1037. ]
  1038. },
  1039. "S3Key": "aws-instance-scheduler/v1.3.3/instance-scheduler.aws.zip"
  1040. },
  1041. "Handler": "main.lambda_handler",
  1042. "Role": {
  1043. "Fn::GetAtt": [
  1044. "SchedulerRole",
  1045. "Arn"
  1046. ]
  1047. },
  1048. "Runtime": "python3.7",
  1049. "Description": "EC2 and RDS instance scheduler, version v1.3.3",
  1050. "Environment": {
  1051. "Variables": {
  1052. "SCHEDULER_FREQUENCY": {
  1053. "Ref": "SchedulerFrequency"
  1054. },
  1055. "TAG_NAME": {
  1056. "Ref": "TagName"
  1057. },
  1058. "LOG_GROUP": {
  1059. "Ref": "SchedulerLogGroup"
  1060. },
  1061. "ACCOUNT": {
  1062. "Ref": "AWS::AccountId"
  1063. },
  1064. "ISSUES_TOPIC_ARN": {
  1065. "Ref": "InstanceSchedulerSnsTopic"
  1066. },
  1067. "STACK_NAME": {
  1068. "Ref": "AWS::StackName"
  1069. },
  1070. "BOTO_RETRY": "5,10,30,0.25",
  1071. "ENV_BOTO_RETRY_LOGGING": "FALSE",
  1072. "SEND_METRICS": {
  1073. "Fn::FindInMap": [
  1074. "mappings",
  1075. "TrueFalse",
  1076. {
  1077. "Ref": "SendAnonymousData"
  1078. }
  1079. ]
  1080. },
  1081. "SOLUTION_ID": {
  1082. "Fn::FindInMap": [
  1083. "mappings",
  1084. "Settings",
  1085. "MetricsSolutionId"
  1086. ]
  1087. },
  1088. "TRACE": {
  1089. "Fn::FindInMap": [
  1090. "mappings",
  1091. "TrueFalse",
  1092. {
  1093. "Ref": "Trace"
  1094. }
  1095. ]
  1096. },
  1097. "USER_AGENT": {
  1098. "Fn::Join": [
  1099. "",
  1100. [
  1101. "InstanceScheduler-",
  1102. {
  1103. "Ref": "AWS::StackName"
  1104. },
  1105. "-v1.3.3"
  1106. ]
  1107. ]
  1108. },
  1109. "METRICS_URL": {
  1110. "Fn::FindInMap": [
  1111. "mappings",
  1112. "Settings",
  1113. "MetricsUrl"
  1114. ]
  1115. },
  1116. "SCHEDULER_RULE": "aws-instance-schedulerscheduling_rule",
  1117. "DDB_TABLE_NAME": {
  1118. "Ref": "StateTable"
  1119. },
  1120. "CONFIG_TABLE": {
  1121. "Ref": "ConfigTable"
  1122. },
  1123. "MAINTENANCE_WINDOW_TABLE": {
  1124. "Ref": "MaintenanceWindowTable"
  1125. },
  1126. "STATE_TABLE": {
  1127. "Ref": "StateTable"
  1128. }
  1129. }
  1130. },
  1131. "FunctionName": {
  1132. "Fn::Join": [
  1133. "",
  1134. [
  1135. {
  1136. "Ref": "AWS::StackName"
  1137. },
  1138. "-InstanceSchedulerMain"
  1139. ]
  1140. ]
  1141. },
  1142. "MemorySize": {
  1143. "Ref": "MemorySize"
  1144. },
  1145. "Timeout": 300
  1146. },
  1147. "DependsOn": [
  1148. "EC2DynamoDBPolicy",
  1149. "SchedulerPolicy",
  1150. "SchedulerRoleDefaultPolicy66F774B8",
  1151. "SchedulerRole"
  1152. ],
  1153. "Metadata": {
  1154. "cfn_nag": {
  1155. "rules_to_suppress": [
  1156. {
  1157. "id": "W58",
  1158. "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."
  1159. }
  1160. ]
  1161. }
  1162. }
  1163. },
  1164. "instanceschedulerlambdaLambdaFunctionLambdaInvokePermissionB1734834": {
  1165. "Type": "AWS::Lambda::Permission",
  1166. "Properties": {
  1167. "Action": "lambda:InvokeFunction",
  1168. "FunctionName": {
  1169. "Fn::GetAtt": [
  1170. "Main",
  1171. "Arn"
  1172. ]
  1173. },
  1174. "Principal": "events.amazonaws.com",
  1175. "SourceArn": {
  1176. "Fn::GetAtt": [
  1177. "SchedulerRule",
  1178. "Arn"
  1179. ]
  1180. }
  1181. },
  1182. "Metadata": {
  1183. "aws:cdk:path": "instance-scheduler/instance-scheduler-lambda/LambdaFunction/LambdaInvokePermission"
  1184. }
  1185. },
  1186. "StateTable": {
  1187. "Type": "AWS::DynamoDB::Table",
  1188. "Properties": {
  1189. "KeySchema": [
  1190. {
  1191. "AttributeName": "service",
  1192. "KeyType": "HASH"
  1193. },
  1194. {
  1195. "AttributeName": "account-region",
  1196. "KeyType": "RANGE"
  1197. }
  1198. ],
  1199. "AttributeDefinitions": [
  1200. {
  1201. "AttributeName": "service",
  1202. "AttributeType": "S"
  1203. },
  1204. {
  1205. "AttributeName": "account-region",
  1206. "AttributeType": "S"
  1207. }
  1208. ],
  1209. "BillingMode": "PAY_PER_REQUEST",
  1210. "SSESpecification": {
  1211. "KMSMasterKeyId": {
  1212. "Ref": "InstanceSchedulerEncryptionKey"
  1213. },
  1214. "SSEEnabled": true,
  1215. "SSEType": "KMS"
  1216. }
  1217. },
  1218. "UpdateReplacePolicy": "Delete",
  1219. "DeletionPolicy": "Delete",
  1220. "Metadata": {
  1221. "aws:cdk:path": "instance-scheduler/instance-scheduler-lambda/DynamoTable/Resource"
  1222. }
  1223. },
  1224. "ConfigTable": {
  1225. "Type": "AWS::DynamoDB::Table",
  1226. "Properties": {
  1227. "KeySchema": [
  1228. {
  1229. "AttributeName": "type",
  1230. "KeyType": "HASH"
  1231. },
  1232. {
  1233. "AttributeName": "name",
  1234. "KeyType": "RANGE"
  1235. }
  1236. ],
  1237. "AttributeDefinitions": [
  1238. {
  1239. "AttributeName": "type",
  1240. "AttributeType": "S"
  1241. },
  1242. {
  1243. "AttributeName": "name",
  1244. "AttributeType": "S"
  1245. }
  1246. ],
  1247. "BillingMode": "PAY_PER_REQUEST",
  1248. "SSESpecification": {
  1249. "KMSMasterKeyId": {
  1250. "Ref": "InstanceSchedulerEncryptionKey"
  1251. },
  1252. "SSEEnabled": true,
  1253. "SSEType": "KMS"
  1254. }
  1255. },
  1256. "UpdateReplacePolicy": "Delete",
  1257. "DeletionPolicy": "Delete",
  1258. "Metadata": {
  1259. "aws:cdk:path": "instance-scheduler/ConfigTable/Resource"
  1260. }
  1261. },
  1262. "MaintenanceWindowTable": {
  1263. "Type": "AWS::DynamoDB::Table",
  1264. "Properties": {
  1265. "KeySchema": [
  1266. {
  1267. "AttributeName": "Name",
  1268. "KeyType": "HASH"
  1269. }
  1270. ],
  1271. "AttributeDefinitions": [
  1272. {
  1273. "AttributeName": "Name",
  1274. "AttributeType": "S"
  1275. }
  1276. ],
  1277. "BillingMode": "PAY_PER_REQUEST",
  1278. "SSESpecification": {
  1279. "KMSMasterKeyId": {
  1280. "Ref": "InstanceSchedulerEncryptionKey"
  1281. },
  1282. "SSEEnabled": true,
  1283. "SSEType": "KMS"
  1284. }
  1285. },
  1286. "UpdateReplacePolicy": "Delete",
  1287. "DeletionPolicy": "Delete",
  1288. "Metadata": {
  1289. "aws:cdk:path": "instance-scheduler/MaintenanceWindowTable/Resource"
  1290. }
  1291. },
  1292. "SchedulerRule": {
  1293. "Type": "AWS::Events::Rule",
  1294. "Properties": {
  1295. "Description": "Instance Scheduler - Rule to trigger instance for scheduler function version v1.3.3",
  1296. "Name": "aws-instance-schedulerscheduling_rule",
  1297. "ScheduleExpression": {
  1298. "Fn::FindInMap": [
  1299. "mappings",
  1300. "Timeouts",
  1301. {
  1302. "Ref": "SchedulerFrequency"
  1303. }
  1304. ]
  1305. },
  1306. "State": {
  1307. "Fn::FindInMap": [
  1308. "mappings",
  1309. "EnabledDisabled",
  1310. {
  1311. "Ref": "SchedulingActive"
  1312. }
  1313. ]
  1314. },
  1315. "Targets": [
  1316. {
  1317. "Arn": {
  1318. "Fn::GetAtt": [
  1319. "Main",
  1320. "Arn"
  1321. ]
  1322. },
  1323. "Id": "Target0"
  1324. }
  1325. ]
  1326. },
  1327. "Metadata": {
  1328. "aws:cdk:path": "instance-scheduler/EventlambdaConstruct/EventsRule/Resource"
  1329. }
  1330. },
  1331. "SchedulerConfigHelper": {
  1332. "Type": "Custom::ServiceSetup",
  1333. "Properties": {
  1334. "ServiceToken": {
  1335. "Fn::GetAtt": [
  1336. "Main",
  1337. "Arn"
  1338. ]
  1339. },
  1340. "timeout": 120,
  1341. "config_table": {
  1342. "Ref": "ConfigTable"
  1343. },
  1344. "tagname": {
  1345. "Ref": "TagName"
  1346. },
  1347. "default_timezone": {
  1348. "Ref": "DefaultTimezone"
  1349. },
  1350. "use_metrics": {
  1351. "Fn::FindInMap": [
  1352. "mappings",
  1353. "TrueFalse",
  1354. {
  1355. "Ref": "UseCloudWatchMetrics"
  1356. }
  1357. ]
  1358. },
  1359. "scheduled_services": {
  1360. "Fn::Split": [
  1361. ",",
  1362. {
  1363. "Fn::FindInMap": [
  1364. "mappings",
  1365. "Services",
  1366. {
  1367. "Ref": "ScheduledServices"
  1368. }
  1369. ]
  1370. }
  1371. ]
  1372. },
  1373. "schedule_clusters": {
  1374. "Fn::FindInMap": [
  1375. "mappings",
  1376. "TrueFalse",
  1377. {
  1378. "Ref": "ScheduleRdsClusters"
  1379. }
  1380. ]
  1381. },
  1382. "create_rds_snapshot": {
  1383. "Fn::FindInMap": [
  1384. "mappings",
  1385. "TrueFalse",
  1386. {
  1387. "Ref": "CreateRdsSnapshot"
  1388. }
  1389. ]
  1390. },
  1391. "regions": {
  1392. "Ref": "Regions"
  1393. },
  1394. "cross_account_roles": {
  1395. "Ref": "CrossAccountRoles"
  1396. },
  1397. "schedule_lambda_account": {
  1398. "Fn::FindInMap": [
  1399. "mappings",
  1400. "TrueFalse",
  1401. {
  1402. "Ref": "ScheduleLambdaAccount"
  1403. }
  1404. ]
  1405. },
  1406. "trace": {
  1407. "Fn::FindInMap": [
  1408. "mappings",
  1409. "TrueFalse",
  1410. {
  1411. "Ref": "Trace"
  1412. }
  1413. ]
  1414. },
  1415. "log_retention_days": {
  1416. "Ref": "LogRetentionDays"
  1417. },
  1418. "started_tags": {
  1419. "Ref": "StartedTags"
  1420. },
  1421. "stopped_tags": {
  1422. "Ref": "StoppedTags"
  1423. },
  1424. "stack_version": "v1.3.3"
  1425. },
  1426. "DependsOn": [
  1427. "SchedulerLogGroup"
  1428. ],
  1429. "UpdateReplacePolicy": "Delete",
  1430. "DeletionPolicy": "Delete",
  1431. "Metadata": {
  1432. "aws:cdk:path": "instance-scheduler/ServiceSetup/Default"
  1433. }
  1434. },
  1435. "EC2DynamoDBPolicy": {
  1436. "Type": "AWS::IAM::Policy",
  1437. "Properties": {
  1438. "PolicyDocument": {
  1439. "Statement": [
  1440. {
  1441. "Action": "sts:AssumeRole",
  1442. "Effect": "Allow",
  1443. "Resource": "arn:aws:iam::*:role/*EC2SchedulerCross*"
  1444. },
  1445. {
  1446. "Action": [
  1447. "ssm:GetParameter",
  1448. "ssm:GetParameters"
  1449. ],
  1450. "Effect": "Allow",
  1451. "Resource": {
  1452. "Fn::Join": [
  1453. "",
  1454. [
  1455. "arn:aws:ssm:*:",
  1456. {
  1457. "Ref": "AWS::AccountId"
  1458. },
  1459. ":parameter/*"
  1460. ]
  1461. ]
  1462. }
  1463. },
  1464. {
  1465. "Action": [
  1466. "logs:DescribeLogStreams",
  1467. "rds:DescribeDBClusters",
  1468. "rds:DescribeDBInstances",
  1469. "ec2:DescribeInstances",
  1470. "ec2:DescribeRegions",
  1471. "ec2:ModifyInstanceAttribute",
  1472. "cloudwatch:PutMetricData",
  1473. "ssm:DescribeMaintenanceWindows",
  1474. "tag:GetResources"
  1475. ],
  1476. "Effect": "Allow",
  1477. "Resource": "*"
  1478. },
  1479. {
  1480. "Action": [
  1481. "logs:CreateLogGroup",
  1482. "logs:CreateLogStream",
  1483. "logs:PutLogEvents",
  1484. "logs:PutRetentionPolicy"
  1485. ],
  1486. "Effect": "Allow",
  1487. "Resource": [
  1488. {
  1489. "Fn::Join": [
  1490. "",
  1491. [
  1492. "arn:aws:logs:",
  1493. {
  1494. "Ref": "AWS::Region"
  1495. },
  1496. ":",
  1497. {
  1498. "Ref": "AWS::AccountId"
  1499. },
  1500. ":log-group:/aws/lambda/*"
  1501. ]
  1502. ]
  1503. },
  1504. {
  1505. "Fn::GetAtt": [
  1506. "SchedulerLogGroup",
  1507. "Arn"
  1508. ]
  1509. }
  1510. ]
  1511. }
  1512. ],
  1513. "Version": "2012-10-17"
  1514. },
  1515. "PolicyName": "EC2DynamoDBPolicy",
  1516. "Roles": [
  1517. {
  1518. "Ref": "SchedulerRole"
  1519. }
  1520. ]
  1521. },
  1522. "Metadata": {
  1523. "cfn_nag": {
  1524. "rules_to_suppress": [
  1525. {
  1526. "id": "W12",
  1527. "reason": "All policies have been scoped to be as restrictive as possible. This solution needs to access ec2/rds resources across all regions."
  1528. }
  1529. ]
  1530. }
  1531. }
  1532. },
  1533. "SchedulerPolicy": {
  1534. "Type": "AWS::IAM::Policy",
  1535. "Properties": {
  1536. "PolicyDocument": {
  1537. "Statement": [
  1538. {
  1539. "Action": [
  1540. "rds:DeleteDBSnapshot",
  1541. "rds:DescribeDBSnapshots",
  1542. "rds:StopDBInstance"
  1543. ],
  1544. "Effect": "Allow",
  1545. "Resource": {
  1546. "Fn::Join": [
  1547. "",
  1548. [
  1549. "arn:aws:rds:*:",
  1550. {
  1551. "Ref": "AWS::AccountId"
  1552. },
  1553. ":snapshot:*"
  1554. ]
  1555. ]
  1556. }
  1557. },
  1558. {
  1559. "Action": [
  1560. "rds:AddTagsToResource",
  1561. "rds:RemoveTagsFromResource",
  1562. "rds:DescribeDBSnapshots",
  1563. "rds:StartDBInstance",
  1564. "rds:StopDBInstance"
  1565. ],
  1566. "Effect": "Allow",
  1567. "Resource": {
  1568. "Fn::Join": [
  1569. "",
  1570. [
  1571. "arn:aws:rds:*:",
  1572. {
  1573. "Ref": "AWS::AccountId"
  1574. },
  1575. ":db:*"
  1576. ]
  1577. ]
  1578. }
  1579. },
  1580. {
  1581. "Action": [
  1582. "ec2:StartInstances",
  1583. "ec2:StopInstances",
  1584. "ec2:CreateTags",
  1585. "ec2:DeleteTags"
  1586. ],
  1587. "Effect": "Allow",
  1588. "Resource": {
  1589. "Fn::Join": [
  1590. "",
  1591. [
  1592. "arn:aws:ec2:*:",
  1593. {
  1594. "Ref": "AWS::AccountId"
  1595. },
  1596. ":instance/*"
  1597. ]
  1598. ]
  1599. }
  1600. },
  1601. {
  1602. "Action": "sns:Publish",
  1603. "Effect": "Allow",
  1604. "Resource": {
  1605. "Ref": "InstanceSchedulerSnsTopic"
  1606. }
  1607. },
  1608. {
  1609. "Action": "lambda:InvokeFunction",
  1610. "Effect": "Allow",
  1611. "Resource": {
  1612. "Fn::Join": [
  1613. "",
  1614. [
  1615. "arn:aws:lambda:",
  1616. {
  1617. "Ref": "AWS::Region"
  1618. },
  1619. ":",
  1620. {
  1621. "Ref": "AWS::AccountId"
  1622. },
  1623. ":function:",
  1624. {
  1625. "Ref": "AWS::StackName"
  1626. },
  1627. "-InstanceSchedulerMain"
  1628. ]
  1629. ]
  1630. }
  1631. },
  1632. {
  1633. "Action": [
  1634. "kms:GenerateDataKey*",
  1635. "kms:Decrypt"
  1636. ],
  1637. "Effect": "Allow",
  1638. "Resource": {
  1639. "Fn::GetAtt": [
  1640. "InstanceSchedulerEncryptionKey",
  1641. "Arn"
  1642. ]
  1643. }
  1644. },
  1645. {
  1646. "Action": [
  1647. "rds:AddTagsToResource",
  1648. "rds:RemoveTagsFromResource",
  1649. "rds:StartDBCluster",
  1650. "rds:StopDBCluster"
  1651. ],
  1652. "Effect": "Allow",
  1653. "Resource": {
  1654. "Fn::Join": [
  1655. "",
  1656. [
  1657. "arn:aws:rds:*:",
  1658. {
  1659. "Ref": "AWS::AccountId"
  1660. },
  1661. ":cluster:*"
  1662. ]
  1663. ]
  1664. }
  1665. }
  1666. ],
  1667. "Version": "2012-10-17"
  1668. },
  1669. "PolicyName": "SchedulerPolicy",
  1670. "Roles": [
  1671. {
  1672. "Ref": "SchedulerRole"
  1673. }
  1674. ]
  1675. },
  1676. "Metadata": {
  1677. "aws:cdk:path": "instance-scheduler/SchedulerPolicy/Resource"
  1678. }
  1679. }
  1680. },
  1681. "Outputs": {
  1682. "AccountId": {
  1683. "Description": "Account to give access to when creating cross-account access role fro cross account scenario ",
  1684. "Value": {
  1685. "Ref": "AWS::AccountId"
  1686. }
  1687. },
  1688. "ConfigurationTable": {
  1689. "Description": "Name of the DynamoDB configuration table",
  1690. "Value": {
  1691. "Fn::GetAtt": [
  1692. "ConfigTable",
  1693. "Arn"
  1694. ]
  1695. }
  1696. },
  1697. "IssueSnsTopicArn": {
  1698. "Description": "Topic to subscribe to for notifications of errors and warnings",
  1699. "Value": {
  1700. "Ref": "InstanceSchedulerSnsTopic"
  1701. }
  1702. },
  1703. "SchedulerRoleArn": {
  1704. "Description": "Role for the instance scheduler lambda function",
  1705. "Value": {
  1706. "Fn::GetAtt": [
  1707. "SchedulerRole",
  1708. "Arn"
  1709. ]
  1710. }
  1711. },
  1712. "ServiceInstanceScheduleServiceToken": {
  1713. "Description": "Arn to use as ServiceToken property for custom resource type Custom::ServiceInstanceSchedule",
  1714. "Value": {
  1715. "Fn::GetAtt": [
  1716. "Main",
  1717. "Arn"
  1718. ]
  1719. }
  1720. }
  1721. }
  1722. }