Last active
March 19, 2019 13:24
-
-
Save kagarlickij/fee881b87c956b8df62759b8f70f69e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AWSTemplateFormatVersion" : "2010-09-09", | |
| "Description" : "nopCommerce single level app tier", | |
| "Parameters" : { | |
| "KeyName" : { | |
| "Description" : "Name of an existing EC2 KeyPair", | |
| "Type" : "AWS::EC2::KeyPair::KeyName", | |
| "ConstraintDescription" : "must be the name of an existing EC2 KeyPair." | |
| }, | |
| "RDPCidr" : { | |
| "Description" : "IP Cidr that is allowed to RDP to EC2", | |
| "Type" : "String", | |
| "MinLength" : "9", | |
| "MaxLength" : "18", | |
| "AllowedPattern" : "^([0-9]+\\.){3}[0-9]+\\/[0-9]+$" | |
| }, | |
| "SNSEndpoint" : { | |
| "Description" : "Email for notifications", | |
| "Type" : "String" | |
| } | |
| }, | |
| "Resources" : { | |
| "NotificationTopic" : { | |
| "Type" : "AWS::SNS::Topic", | |
| "Properties" : { | |
| "DisplayName" : "nopCommerce-demo", | |
| "Subscription" : [ { "Endpoint": { "Ref" : "SNSEndpoint" }, "Protocol": "email" } ], | |
| "TopicName" : "nopCommerce-demo" | |
| } | |
| }, | |
| "WebServerSecurityGroup" : { | |
| "Type" : "AWS::EC2::SecurityGroup", | |
| "Properties" : { | |
| "GroupDescription" : "Enable http access from anywhere and RDP from office", | |
| "SecurityGroupIngress": [ | |
| {"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"}, | |
| {"IpProtocol" : "tcp", "FromPort" : "3389", "ToPort" : "3389", "CidrIp" : { "Ref" : "RDPCidr" } } | |
| ] | |
| } | |
| }, | |
| "WebServerGroup" : { | |
| "Type" : "AWS::AutoScaling::AutoScalingGroup", | |
| "Properties" : { | |
| "AvailabilityZones" : { "Fn::GetAZs" : ""}, | |
| "Cooldown" : "60", | |
| "HealthCheckGracePeriod" : "120", | |
| "HealthCheckType" : "EC2", | |
| "LaunchConfigurationName" : { "Ref" : "LaunchConfig" }, | |
| "MinSize" : "2", | |
| "MaxSize" : "4", | |
| "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ], | |
| "MetricsCollection" : [ { | |
| "Granularity" : "1Minute" | |
| } ], | |
| "NotificationConfiguration" : { | |
| "TopicARN" : { "Ref" : "NotificationTopic" }, | |
| "NotificationTypes" : [ | |
| "autoscaling:EC2_INSTANCE_LAUNCH", | |
| "autoscaling:EC2_INSTANCE_LAUNCH_ERROR", | |
| "autoscaling:EC2_INSTANCE_TERMINATE", | |
| "autoscaling:EC2_INSTANCE_TERMINATE_ERROR" | |
| ] | |
| } | |
| }, | |
| "UpdatePolicy" : { | |
| "AutoScalingRollingUpdate" : { | |
| "MaxBatchSize" : "1", | |
| "MinInstancesInService" : "0", | |
| "MinSuccessfulInstancesPercent" : "100", | |
| "WaitOnResourceSignals" : "true" | |
| } | |
| } | |
| }, | |
| "LaunchConfig" : { | |
| "Type" : "AWS::AutoScaling::LaunchConfiguration", | |
| "Properties" : { | |
| "BlockDeviceMappings" : [ { | |
| "DeviceName" : "/dev/sda1", | |
| "Ebs" : { "VolumeSize" : "50" , "VolumeType" : "io1" , "Iops" : "1500" } | |
| } ], | |
| "IamInstanceProfile" : "arn:aws:iam::481443282809:instance-profile/aws-elasticbeanstalk-ec2-role", | |
| "ImageId" : "ami-5f726935", | |
| "InstanceMonitoring" : "true", | |
| "InstanceType" : "m4.large", | |
| "KeyName" : { "Ref" : "KeyName" }, | |
| "SecurityGroups" : [ { "Ref" : "WebServerSecurityGroup" } ] | |
| } | |
| }, | |
| "ElasticLoadBalancer" : { | |
| "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", | |
| "Properties" : { | |
| "AvailabilityZones" : { | |
| "Fn::GetAZs" : "" | |
| }, | |
| "CrossZone" : "true", | |
| "Listeners" : [ { | |
| "LoadBalancerPort" : "80", | |
| "InstancePort" : "80", | |
| "Protocol" : "HTTP" | |
| } ], | |
| "HealthCheck" : { | |
| "Interval" : "15", | |
| "HealthyThreshold" : "3", | |
| "Target" : "HTTP:80/", | |
| "Timeout" : "3", | |
| "UnhealthyThreshold" : "2" | |
| } | |
| } | |
| }, | |
| "WebServerScaleUpPolicy" : { | |
| "Type" : "AWS::AutoScaling::ScalingPolicy", | |
| "Properties" : { | |
| "AdjustmentType" : "ChangeInCapacity", | |
| "AutoScalingGroupName" : { "Ref" : "WebServerGroup" }, | |
| "Cooldown" : "60", | |
| "PolicyType" : "SimpleScaling", | |
| "ScalingAdjustment" : "1" | |
| } | |
| }, | |
| "WebServerScaleDownPolicy" : { | |
| "Type" : "AWS::AutoScaling::ScalingPolicy", | |
| "Properties" : { | |
| "AdjustmentType" : "ChangeInCapacity", | |
| "AutoScalingGroupName" : { "Ref" : "WebServerGroup" }, | |
| "Cooldown" : "60", | |
| "PolicyType" : "SimpleScaling", | |
| "ScalingAdjustment" : "-1" | |
| } | |
| }, | |
| "CPUAlarmHigh" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties" : { | |
| "ActionsEnabled" : "true", | |
| "AlarmActions" : [ { | |
| "Ref" : "WebServerScaleUpPolicy" | |
| }, | |
| { | |
| "Ref": "NotificationTopic" | |
| } ], | |
| "AlarmDescription" : "Scale-up if CPU > 75% for 10 minutes", | |
| "AlarmName" : "CPUAlarmHigh", | |
| "ComparisonOperator" : "GreaterThanThreshold", | |
| "Dimensions" : [ { | |
| "Name" : "AutoScalingGroupName", | |
| "Value" : { "Ref": "WebServerGroup" } | |
| } ], | |
| "EvaluationPeriods" : "2", | |
| "MetricName" : "CPUUtilization", | |
| "Namespace" : "AWS/EC2", | |
| "Statistic" : "Average", | |
| "Period" : "300", | |
| "Threshold" : "75" | |
| } | |
| }, | |
| "CPUAlarmLow": { | |
| "Type": "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled" : "true", | |
| "AlarmActions" : [ { | |
| "Ref" : "WebServerScaleDownPolicy" | |
| } ], | |
| "AlarmDescription" : "Scale-down if CPU < 50% for 10 minutes", | |
| "AlarmName" : "CPUAlarmLow", | |
| "ComparisonOperator" : "LessThanThreshold", | |
| "Dimensions" : [ { | |
| "Name" : "AutoScalingGroupName", | |
| "Value" : { "Ref": "WebServerGroup" } | |
| } ], | |
| "EvaluationPeriods" : "2", | |
| "MetricName" : "CPUUtilization", | |
| "Namespace" : "AWS/EC2", | |
| "Statistic" : "Average", | |
| "Period" : "300", | |
| "Threshold" : "50" | |
| } | |
| }, | |
| "ELBLatency" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB Latency", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "Latency", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "1" | |
| } | |
| }, | |
| "ELBSpilloverCount" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB SpilloverCount", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "SpilloverCount", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Maximum", | |
| "Period": "300", | |
| "Threshold": "10" | |
| } | |
| }, | |
| "ELBSurgeQueueLength" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB SurgeQueueLength", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "SurgeQueueLength", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Maximum", | |
| "Period": "300", | |
| "Threshold": "512" | |
| } | |
| }, | |
| "ELBRequestCount" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB RequestCount", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "RequestCount", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Sum", | |
| "Period": "300", | |
| "Threshold": "10000" | |
| } | |
| }, | |
| "ELBHealthyHostCount" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB Healthy Host Count", | |
| "ComparisonOperator": "LessThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "HealthyHostCount", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "1" | |
| } | |
| }, | |
| "ELBHTTPCode4XX" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB HTTPCode_ELB_4XX", | |
| "ComparisonOperator": "LessThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "HTTPCode_ELB_4XX", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Sum", | |
| "Period": "300", | |
| "Threshold": "100" | |
| } | |
| }, | |
| "ELBHTTPCode5XX" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "ELB HTTPCode_ELB_5XX", | |
| "ComparisonOperator": "LessThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "LoadBalancerName", | |
| "Value": { "Ref" : "ElasticLoadBalancer" } | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "HTTPCode_ELB_5XX", | |
| "Namespace": "AWS/ELB", | |
| "Statistic": "Sum", | |
| "Period": "300", | |
| "Threshold": "100" | |
| } | |
| }, | |
| "CostAlarm": { | |
| "Type": "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled" : "true", | |
| "AlarmActions": [{ | |
| "Ref" : "NotificationTopic" | |
| }], | |
| "AlarmDescription": "Cost tracking", | |
| "AlarmName" : "CostAlarm", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [{ | |
| "Name": "Currency", | |
| "Value" : "USD" | |
| }], | |
| "EvaluationPeriods" : "1", | |
| "InsufficientDataActions": [{ | |
| "Ref" : "NotificationTopic" | |
| }], | |
| "MetricName": "EstimatedCharges", | |
| "Namespace": "AWS/Billing", | |
| "Statistic": "Maximum", | |
| "Period": "21600", | |
| "Threshold": "100" | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AWSTemplateFormatVersion": "2010-09-09", | |
| "Description": "test RDS", | |
| "Parameters": { | |
| "DBUser": { | |
| "NoEcho": "true", | |
| "Description": "The database admin account username", | |
| "Type": "String", | |
| "MinLength": "1", | |
| "MaxLength": "16", | |
| "AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*", | |
| "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters." | |
| }, | |
| "DBPassword": { | |
| "NoEcho": "true", | |
| "Description": "The database admin account password", | |
| "Type": "String", | |
| "MinLength": "8", | |
| "MaxLength": "41", | |
| "AllowedPattern": "[a-zA-Z0-9]*", | |
| "ConstraintDescription": "must contain only alphanumeric characters." | |
| }, | |
| "DBInstanceId" : { | |
| "Description" : "Database instance identifier", | |
| "Type" : "String" | |
| }, | |
| "SNSEndpoint": { | |
| "Description": "Email for notifications", | |
| "Type": "String" | |
| } | |
| }, | |
| "Resources": { | |
| "NotificationTopic": { | |
| "Type": "AWS::SNS::Topic", | |
| "Properties": { | |
| "DisplayName": "RDS-SQL-SE-demo", | |
| "Subscription": [ | |
| { | |
| "Endpoint": { | |
| "Ref": "SNSEndpoint" | |
| }, | |
| "Protocol": "email" | |
| } | |
| ], | |
| "TopicName": { | |
| "Ref" : "DBInstanceId" | |
| } | |
| } | |
| }, | |
| "DBServerSecurityGroup" : { | |
| "Type" : "AWS::EC2::SecurityGroup", | |
| "Properties" : { | |
| "GroupDescription" : "Enable 1433 access from VPC", | |
| "SecurityGroupIngress" : [ | |
| {"IpProtocol" : "tcp", "FromPort" : "1433", "ToPort" : "1433", "CidrIp" : "172.31.0.0/16"} | |
| ] | |
| } | |
| }, | |
| "OptionGroup": { | |
| "Type": "AWS::RDS::OptionGroup", | |
| "Properties": { | |
| "EngineName": "sqlserver-se", | |
| "MajorEngineVersion": "12.00", | |
| "OptionGroupDescription": "OptionGroup", | |
| "OptionConfigurations":[ | |
| { | |
| "OptionName": "Mirroring" | |
| } | |
| ] | |
| } | |
| }, | |
| "DBInstance": { | |
| "Type": "AWS::RDS::DBInstance", | |
| "Properties": { | |
| "AllocatedStorage": "200", | |
| "AllowMajorVersionUpgrade": "false", | |
| "AutoMinorVersionUpgrade": "true", | |
| "BackupRetentionPeriod": "30", | |
| "DBInstanceClass": "db.m3.xlarge", | |
| "DBInstanceIdentifier": { | |
| "Ref" : "DBInstanceId" | |
| }, | |
| "Engine": "sqlserver-se", | |
| "EngineVersion": "12.00.4422.0.v1", | |
| "Iops": "1000", | |
| "LicenseModel": "license-included", | |
| "PreferredBackupWindow": "01:00-03:00", | |
| "PreferredMaintenanceWindow": "sun:06:00-sun:06:30", | |
| "MasterUsername": { | |
| "Ref": "DBUser" | |
| }, | |
| "MasterUserPassword": { | |
| "Ref": "DBPassword" | |
| }, | |
| "OptionGroupName": { | |
| "Ref": "OptionGroup" | |
| }, | |
| "PubliclyAccessible": "false", | |
| "StorageEncrypted": "true", | |
| "StorageType": "io1", | |
| "VPCSecurityGroups": [ { | |
| "Fn::GetAtt" : [ "DBServerSecurityGroup" , "GroupId" ] | |
| } ] | |
| }, | |
| "DeletionPolicy" : "Snapshot" | |
| }, | |
| "RDSEventSubscription" : { | |
| "Type" : "AWS::RDS::EventSubscription", | |
| "Properties" : { | |
| "Enabled" : "true", | |
| "EventCategories" : [ | |
| "availability", | |
| "backup", | |
| "configuration change", | |
| "deletion", | |
| "failover", | |
| "failure", | |
| "low storage", | |
| "maintenance", | |
| "notification", | |
| "recovery", | |
| "restoration" | |
| ], | |
| "SnsTopicArn" : {"Ref": "NotificationTopic"}, | |
| "SourceType" : "db-instance" | |
| } | |
| }, | |
| "RDSCPUUtilization" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS CPU Utilization", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "CPUUtilization", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "75" | |
| } | |
| }, | |
| "RDSFreeStorageSpace" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS Free Storage Space", | |
| "ComparisonOperator": "LessThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "FreeStorageSpace", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "20000000000" | |
| } | |
| }, | |
| "RDSDiskQueueDepth" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS Disk Queue Depth", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "DiskQueueDepth", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "10" | |
| } | |
| }, | |
| "RDSFreeableMemory" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS Freeable Memory", | |
| "ComparisonOperator": "LessThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "FreeableMemory", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "536870912" | |
| } | |
| }, | |
| "RDSReadLatency" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS Read Latency", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "ReadLatency", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "0.1" | |
| } | |
| }, | |
| "RDSWriteLatency" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS Write Latency", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "WriteLatency", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "0.1" | |
| } | |
| }, | |
| "RDSDatabaseConnections" : { | |
| "Type" : "AWS::CloudWatch::Alarm", | |
| "Properties": { | |
| "ActionsEnabled": "true", | |
| "AlarmActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "AlarmDescription": "RDS Database Connections", | |
| "ComparisonOperator": "GreaterThanThreshold", | |
| "Dimensions": [ | |
| { | |
| "Name": "DBInstanceIdentifier", | |
| "Value": {"Ref" : "DBInstanceId"} | |
| } | |
| ], | |
| "EvaluationPeriods": "1", | |
| "InsufficientDataActions": [ | |
| { | |
| "Ref": "NotificationTopic" | |
| } | |
| ], | |
| "MetricName": "DatabaseConnections", | |
| "Namespace": "AWS/RDS", | |
| "Statistic": "Average", | |
| "Period": "300", | |
| "Threshold": "50" | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "AWSTemplateFormatVersion": "2010-09-09", | |
| "Description": "test EC2", | |
| "Parameters": { | |
| "KeyName": { | |
| "Description" : "Name of an existing EC2 KeyPair", | |
| "Type": "AWS::EC2::KeyPair::KeyName", | |
| "ConstraintDescription" : "must be the name of an existing EC2 KeyPair." | |
| } | |
| }, | |
| "Resources": { | |
| "WebServerSecurityGroup" : { | |
| "Type" : "AWS::EC2::SecurityGroup", | |
| "Properties" : { | |
| "GroupDescription" : "Enable http access from anywhere and RDP from office", | |
| "SecurityGroupIngress" : [ | |
| {"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"}, | |
| {"IpProtocol" : "tcp", "FromPort" : "3389", "ToPort" : "3389", "CidrIp" : "94.74.72.228/32"} | |
| ] | |
| } | |
| }, | |
| "EC2Instance": { | |
| "Type" : "AWS::EC2::Instance", | |
| "Properties" : { | |
| "ImageId" : "ami-c8a9baa2", | |
| "InstanceInitiatedShutdownBehavior" : "stop", | |
| "InstanceType" : "c4.large", | |
| "KeyName" : { | |
| "Ref": "KeyName" | |
| }, | |
| "Monitoring" : "true", | |
| "SecurityGroupIds" : [ { | |
| "Fn::GetAtt" : [ "WebServerSecurityGroup" , "GroupId" ] | |
| } ], | |
| "Tenancy" : "default", | |
| "BlockDeviceMappings" : [ | |
| { | |
| "DeviceName" : "/dev/sda1", | |
| "Ebs" : { "VolumeSize" : "50" , "VolumeType" : "io1" , "Iops" : "1500" } | |
| } ], | |
| "Volumes" : [ | |
| { | |
| "VolumeId" : { "Ref" : "EBSDisk" }, "Device" : "/dev/sdk" | |
| } ] | |
| } | |
| }, | |
| "EBSDisk": { | |
| "Type":"AWS::EC2::Volume", | |
| "Properties" : { | |
| "AvailabilityZone" : "us-east-1a", | |
| "Encrypted" : "true", | |
| "Iops" : "600", | |
| "Size" : "20", | |
| "VolumeType" : "io1" | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "schemaVersion": "1.0", | |
| "description": "CloudWatch for Windows Instances", | |
| "runtimeConfig": { | |
| "aws:cloudWatch": { | |
| "properties": { | |
| "EngineConfiguration": { | |
| "PollInterval": "00:00:15", | |
| "Components": [ | |
| { | |
| "Id": "ApplicationEventLog", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "LogName": "Application", | |
| "Levels": "3" | |
| } | |
| }, | |
| { | |
| "Id": "SystemEventLog", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "LogName": "System", | |
| "Levels": "7" | |
| } | |
| }, | |
| { | |
| "Id": "SecurityEventLog", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "LogName": "Security", | |
| "Levels": "1" | |
| } | |
| }, | |
| { | |
| "Id": "IISLog", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.IisLog.IisLogInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "LogDirectoryPath": "C:\\inetpub\\logs\\LogFiles\\W3SVC1" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "Memory", | |
| "CounterName": "Available MBytes", | |
| "InstanceName": "", | |
| "MetricName": "AvailableMemory", | |
| "Unit": "Megabytes", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter2", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "Processor", | |
| "CounterName": "% Privileged Time", | |
| "InstanceName": "", | |
| "MetricName": "CPUPrivilegedTime", | |
| "Unit": "Percent", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter3", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "Processor", | |
| "CounterName": "% Processor Time", | |
| "InstanceName": "", | |
| "MetricName": "CPUProcessorTime", | |
| "Unit": "Percent", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter4", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "Processor", | |
| "CounterName": "% User Time", | |
| "InstanceName": "", | |
| "MetricName": "CPUUserTime", | |
| "Unit": "Percent", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter5", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "System", | |
| "CounterName": "Context Switches/sec", | |
| "InstanceName": "", | |
| "MetricName": "SystemContextSwitches", | |
| "Unit": "Count", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter6", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "System", | |
| "CounterName": "Processor Queue Length", | |
| "InstanceName": "", | |
| "MetricName": "SystemProcessorQueueLength", | |
| "Unit": "Count", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter7", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "Memory", | |
| "CounterName": "Page Faults/sec", | |
| "InstanceName": "", | |
| "MetricName": "MemoryPageFaults", | |
| "Unit": "Count/Second", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter8", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "Memory", | |
| "CounterName": "Pages/sec", | |
| "InstanceName": "", | |
| "MetricName": "MemoryPages", | |
| "Unit": "Count/Second", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter9", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "LogicalDisk(C:)", | |
| "CounterName": "Disk Bytes/sec", | |
| "InstanceName": "", | |
| "MetricName": "DiskCBytesSec", | |
| "Unit": "Bytes/Second", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter10", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "LogicalDisk(D:)", | |
| "CounterName": "Disk Bytes/sec", | |
| "InstanceName": "", | |
| "MetricName": "DiskDBytesSec", | |
| "Unit": "Bytes/Second", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter11", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "LogicalDisk(C:)", | |
| "CounterName": "Disk Transfers/sec", | |
| "InstanceName": "", | |
| "MetricName": "DiskCIPOPS", | |
| "Unit": "Count", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter12", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "LogicalDisk(D:)", | |
| "CounterName": "Disk Transfers/sec", | |
| "InstanceName": "", | |
| "MetricName": "DiskDIPOPS", | |
| "Unit": "Count", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter13", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "LogicalDisk(C:)", | |
| "CounterName": "Current Disk Queue Length", | |
| "InstanceName": "", | |
| "MetricName": "DiskCQueue", | |
| "Unit": "Count", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "PerformanceCounter14", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "CategoryName": "LogicalDisk(D:)", | |
| "CounterName": "Current Disk Queue Length", | |
| "InstanceName": "", | |
| "MetricName": "DiskDQueue", | |
| "Unit": "Count", | |
| "DimensionName": "", | |
| "DimensionValue": "" | |
| } | |
| }, | |
| { | |
| "Id": "CloudWatchLogs", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatchLogsOutput,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "AccessKey": "", | |
| "SecretKey": "", | |
| "Region": "us-east-1", | |
| "LogGroup": "Default-Log-Group", | |
| "LogStream": "{instance_id}" | |
| } | |
| }, | |
| { | |
| "Id": "CloudWatch", | |
| "FullName": "AWS.EC2.Windows.CloudWatch.CloudWatch.CloudWatchOutputComponent,AWS.EC2.Windows.CloudWatch", | |
| "Parameters": { | |
| "AccessKey": "", | |
| "SecretKey": "", | |
| "Region": "us-east-1", | |
| "NameSpace": "Windows/Default" | |
| } | |
| } | |
| ], | |
| "Flows": { | |
| "Flows": [ | |
| "(ApplicationEventLog,SystemEventLog,SecurityEventLog,IISLog),CloudWatchLogs", | |
| "(PerformanceCounter), CloudWatch" | |
| ] | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Sid": "AllowAccessToSSM", | |
| "Effect": "Allow", | |
| "Action": [ | |
| "cloudwatch:PutMetricData", | |
| "logs:CreateLogGroup", | |
| "logs:CreateLogStream", | |
| "logs:DescribeLogGroups", | |
| "logs:DescribeLogStreams", | |
| "logs:PutLogEvents" | |
| ], | |
| "Resource": [ | |
| "*" | |
| ] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment