|
18 | 18 | "c3.2xlarge", |
19 | 19 | "c3.xlarge", |
20 | 20 | "c3.large", |
21 | | - "c4.8xlarge", |
22 | | - "c4.4xlarge", |
23 | | - "c4.2xlarge", |
24 | | - "c4.xlarge", |
25 | | - "c4.large", |
26 | 21 | "r3.8xlarge", |
27 | 22 | "r3.4xlarge", |
28 | 23 | "r3.2xlarge", |
|
57 | 52 | "c3.2xlarge", |
58 | 53 | "c3.xlarge", |
59 | 54 | "c3.large", |
60 | | - "c4.8xlarge", |
61 | | - "c4.4xlarge", |
62 | | - "c4.2xlarge", |
63 | | - "c4.xlarge", |
64 | | - "c4.large", |
65 | 55 | "r3.8xlarge", |
66 | 56 | "r3.4xlarge", |
67 | 57 | "r3.2xlarge", |
|
340 | 330 | "Description" : "Additional VPC secuirty group to be added to instances. Defaults to NONE", |
341 | 331 | "Type" : "String", |
342 | 332 | "Default" : "NONE" |
343 | | - }, |
344 | | - "CWLRegion" : { |
345 | | - "Description" : "CloudWatch Logs region", |
346 | | - "Type" : "String", |
347 | | - "Default" : "NONE" |
348 | | - }, |
349 | | - "CWLLogGroup" : { |
350 | | - "Description" : "CloudWatch Logs LogGroup", |
351 | | - "Type" : "String", |
352 | | - "Default" : "NONE" |
353 | 333 | } |
354 | 334 | }, |
355 | 335 | "Conditions" : { |
|
552 | 532 | ] |
553 | 533 | }, |
554 | 534 | "CloudWatchLogs" : { |
555 | | - "Fn::And" : [ |
| 535 | + "Fn::Equals" : [ |
556 | 536 | { |
557 | | - "Fn::Not" : [ |
| 537 | + "Fn::FindInMap" : [ |
| 538 | + "AWSRegion2Capabilites", |
558 | 539 | { |
559 | | - "Fn::Equals" : [ |
560 | | - { |
561 | | - "Ref" : "CWLRegion" |
562 | | - }, |
563 | | - "NONE" |
564 | | - ] |
565 | | - } |
| 540 | + "Ref" : "AWS::Region" |
| 541 | + }, |
| 542 | + "cwl" |
566 | 543 | ] |
567 | 544 | }, |
568 | | - { |
569 | | - "Fn::Not" : [ |
570 | | - { |
571 | | - "Fn::Equals" : [ |
572 | | - { |
573 | | - "Ref" : "CWLLogGroup" |
574 | | - }, |
575 | | - "NONE" |
576 | | - ] |
577 | | - } |
578 | | - ] |
579 | | - } |
| 545 | + "true" |
580 | 546 | ] |
581 | 547 | }, |
582 | 548 | "AddAdditionalSG" : { |
|
642 | 608 | "Arch" : "64HVM", |
643 | 609 | "EBSOpt" : "False" |
644 | 610 | }, |
645 | | - "c4.8xlarge" : { |
646 | | - "Arch" : "64HVM", |
647 | | - "EBSOpt" : "True" |
648 | | - }, |
649 | | - "c4.4xlarge" : { |
650 | | - "Arch" : "64HVM", |
651 | | - "EBSOpt" : "True" |
652 | | - }, |
653 | | - "c4.2xlarge" : { |
654 | | - "Arch" : "64HVM", |
655 | | - "EBSOpt" : "True" |
656 | | - }, |
657 | | - "c4.xlarge" : { |
658 | | - "Arch" : "64HVM", |
659 | | - "EBSOpt" : "True" |
660 | | - }, |
661 | | - "c4.large" : { |
662 | | - "Arch" : "64HVM", |
663 | | - "EBSOpt" : "True" |
664 | | - }, |
665 | 611 | "r3.8xlarge" : { |
666 | 612 | "Arch" : "64HVM", |
667 | 613 | "EBSOpt" : "False" |
|
755 | 701 | "centos6" : { |
756 | 702 | "User" : "ec2-user" |
757 | 703 | }, |
758 | | - "alinux" : { |
759 | | - "User" : "ec2-user" |
760 | | - }, |
761 | 704 | "ubuntu" : { |
762 | 705 | "User" : "ubuntu" |
763 | 706 | } |
764 | 707 | }, |
765 | 708 | "AWSRegion2Capabilites" : { |
766 | 709 | "eu-west-1" : { |
| 710 | + "cwl" : "true", |
767 | 711 | "arn" : "aws" |
768 | 712 | }, |
769 | 713 | "us-east-1" : { |
| 714 | + "cwl" : "true", |
770 | 715 | "arn" : "aws" |
771 | 716 | }, |
772 | 717 | "ap-northeast-1" : { |
| 718 | + "cwl" : "true", |
773 | 719 | "arn" : "aws" |
774 | 720 | }, |
775 | 721 | "us-west-2" : { |
| 722 | + "cwl" : "true", |
776 | 723 | "arn" : "aws" |
777 | 724 | }, |
778 | 725 | "sa-east-1" : { |
| 726 | + "cwl" : "false", |
779 | 727 | "arn" : "aws" |
780 | 728 | }, |
781 | 729 | "us-west-1" : { |
| 730 | + "cwl" : "false", |
782 | 731 | "arn" : "aws" |
783 | 732 | }, |
784 | 733 | "ap-southeast-1" : { |
| 734 | + "cwl" : "true", |
785 | 735 | "arn" : "aws" |
786 | 736 | }, |
787 | 737 | "ap-southeast-2" : { |
| 738 | + "cwl" : "true", |
788 | 739 | "arn" : "aws" |
789 | 740 | }, |
790 | 741 | "eu-central-1" : { |
| 742 | + "cwl" : "false", |
791 | 743 | "arn" : "aws" |
792 | 744 | }, |
793 | 745 | "us-gov-west-1" : { |
| 746 | + "cwl" : "false", |
794 | 747 | "arn" : "aws-us-gov" |
795 | 748 | } |
796 | 749 | } |
|
1208 | 1161 | " || error_exit 'Failed to run cfn-init. If --norollback was specified, check /var/log/cfn-init.log and /var/log/cfncluster.log.'\n", |
1209 | 1162 | "cfn_cwl=", |
1210 | 1163 | { |
1211 | | - "Fn::If" : [ |
1212 | | - "CloudWatchLogs", |
1213 | | - "true", |
1214 | | - "false" |
| 1164 | + "Fn::FindInMap" : [ |
| 1165 | + "AWSRegion2Capabilites", |
| 1166 | + { |
| 1167 | + "Ref" : "AWS::Region" |
| 1168 | + }, |
| 1169 | + "cwl" |
1215 | 1170 | ] |
1216 | 1171 | }, |
1217 | 1172 | "\n", |
1218 | 1173 | "if [ \"$cfn_cwl\" == \"true\" ]; then\n", |
1219 | 1174 | "# Setup CloudWatch Logs agent\n", |
1220 | 1175 | "python /root/awslogs-agent-setup.py -n -r ", |
1221 | 1176 | { |
1222 | | - "Ref" : "CWLRegion" |
| 1177 | + "Ref" : "AWS::Region" |
1223 | 1178 | }, |
1224 | 1179 | " -c /tmp/cwlogs/cfn-logs.conf || error_exit 'Failed to run CloudWatch Logs agent setup'\n", |
1225 | 1180 | "fi\n", |
|
1313 | 1268 | "file = /var/log/cloud-init.log\n", |
1314 | 1269 | "log_group_name = ", |
1315 | 1270 | { |
1316 | | - "Ref" : "CWLLogGroup" |
| 1271 | + "Ref" : "CfnClusterLogs" |
1317 | 1272 | }, |
1318 | 1273 | "\n", |
1319 | 1274 | "log_stream_name = {instance_id}/cloud-init.log\n", |
1320 | 1275 | "datetime_format = %d/%b/%Y:%H:%M:%S\n", |
1321 | | - "[/var/log/cloud-init-output.log]\n", |
1322 | | - "file = /var/log/cloud-init-output.log\n", |
1323 | | - "log_group_name = ", |
1324 | | - { |
1325 | | - "Ref" : "CWLLogGroup" |
1326 | | - }, |
1327 | | - "\n", |
1328 | | - "log_stream_name = {instance_id}/cloud-init-output.log\n", |
1329 | | - "datetime_format = %d/%b/%Y:%H:%M:%S\n", |
1330 | 1276 | "[/var/log/cfn-init.log]\n", |
1331 | 1277 | "file = /var/log/cfn-init.log\n", |
1332 | 1278 | "log_group_name = ", |
1333 | 1279 | { |
1334 | | - "Ref" : "CWLLogGroup" |
| 1280 | + "Ref" : "CfnClusterLogs" |
1335 | 1281 | }, |
1336 | 1282 | "\n", |
1337 | 1283 | "log_stream_name = {instance_id}/cfn-init.log\n", |
|
1340 | 1286 | "file = /var/log/cfn-wire.log\n", |
1341 | 1287 | "log_group_name = ", |
1342 | 1288 | { |
1343 | | - "Ref" : "CWLLogGroup" |
| 1289 | + "Ref" : "CfnClusterLogs" |
1344 | 1290 | }, |
1345 | 1291 | "\n", |
1346 | 1292 | "log_stream_name = {instance_id}/cfn-wire.log\n", |
|
1410 | 1356 | "Ref" : "EphemeralDir" |
1411 | 1357 | }, |
1412 | 1358 | "\n", |
1413 | | - "cfn_shared_dir=", |
1414 | | - { |
1415 | | - "Ref" : "SharedDir" |
1416 | | - }, |
1417 | | - "\n", |
1418 | 1359 | "cfn_proxy=", |
1419 | 1360 | { |
1420 | 1361 | "Ref" : "ProxyServer" |
|
1696 | 1637 | " || error_exit 'Failed to run cfn-init'\n", |
1697 | 1638 | "cfn_cwl=", |
1698 | 1639 | { |
1699 | | - "Fn::If" : [ |
1700 | | - "CloudWatchLogs", |
1701 | | - "true", |
1702 | | - "false" |
| 1640 | + "Fn::FindInMap" : [ |
| 1641 | + "AWSRegion2Capabilites", |
| 1642 | + { |
| 1643 | + "Ref" : "AWS::Region" |
| 1644 | + }, |
| 1645 | + "cwl" |
1703 | 1646 | ] |
1704 | 1647 | }, |
1705 | 1648 | "\n", |
1706 | 1649 | "if [ \"$cfn_cwl\" == \"true\" ]; then\n", |
1707 | 1650 | "# Setup CloudWatch Logs agent\n", |
1708 | 1651 | "python /root/awslogs-agent-setup.py -n -r ", |
1709 | 1652 | { |
1710 | | - "Ref" : "CWLRegion" |
| 1653 | + "Ref" : "AWS::Region" |
1711 | 1654 | }, |
1712 | 1655 | " -c /tmp/cwlogs/cfn-logs.conf || error_exit 'Failed to run CloudWatch Logs agent setup'\n", |
1713 | 1656 | "fi\n", |
|
1829 | 1772 | "Ref" : "EphemeralDir" |
1830 | 1773 | }, |
1831 | 1774 | "\n", |
1832 | | - "cfn_shared_dir=", |
1833 | | - { |
1834 | | - "Ref" : "SharedDir" |
1835 | | - }, |
1836 | | - "\n", |
1837 | 1775 | "cfn_encrypted_ephemeral=", |
1838 | 1776 | { |
1839 | 1777 | "Ref" : "EncryptedEphemeral" |
|
1908 | 1846 | "file = /var/log/cloud-init.log\n", |
1909 | 1847 | "log_group_name = ", |
1910 | 1848 | { |
1911 | | - "Ref" : "CWLLogGroup" |
| 1849 | + "Ref" : "CfnClusterLogs" |
1912 | 1850 | }, |
1913 | 1851 | "\n", |
1914 | 1852 | "log_stream_name = {instance_id}/cloud-init.log\n", |
1915 | 1853 | "datetime_format = %d/%b/%Y:%H:%M:%S\n", |
1916 | | - "[/var/log/cloud-init-output.log]\n", |
1917 | | - "file = /var/log/cloud-init-output.log\n", |
1918 | | - "log_group_name = ", |
1919 | | - { |
1920 | | - "Ref" : "CWLLogGroup" |
1921 | | - }, |
1922 | | - "\n", |
1923 | | - "log_stream_name = {instance_id}/cloud-init-output.log\n", |
1924 | | - "datetime_format = %d/%b/%Y:%H:%M:%S\n", |
1925 | 1854 | "[/var/log/cfn-init.log]\n", |
1926 | 1855 | "file = /var/log/cfn-init.log\n", |
1927 | 1856 | "log_group_name = ", |
1928 | 1857 | { |
1929 | | - "Ref" : "CWLLogGroup" |
| 1858 | + "Ref" : "CfnClusterLogs" |
1930 | 1859 | }, |
1931 | 1860 | "\n", |
1932 | 1861 | "log_stream_name = {instance_id}/cfn-init.log\n", |
|
1935 | 1864 | "file = /var/log/cfn-wire.log\n", |
1936 | 1865 | "log_group_name = ", |
1937 | 1866 | { |
1938 | | - "Ref" : "CWLLogGroup" |
| 1867 | + "Ref" : "CfnClusterLogs" |
1939 | 1868 | }, |
1940 | 1869 | "\n", |
1941 | 1870 | "log_stream_name = {instance_id}/cfn-wire.log\n", |
|
2274 | 2203 | } |
2275 | 2204 | } |
2276 | 2205 | }, |
| 2206 | + "CfnClusterLogs" : { |
| 2207 | + "Type" : "AWS::Logs::LogGroup", |
| 2208 | + "Properties" : { |
| 2209 | + "RetentionInDays" : 7 |
| 2210 | + }, |
| 2211 | + "Condition" : "CloudWatchLogs" |
| 2212 | + }, |
2277 | 2213 | "AssosiateEIP" : { |
2278 | 2214 | "Type" : "AWS::EC2::EIPAssociation", |
2279 | 2215 | "Properties" : { |
|
0 commit comments