From a3f973f85d510404627922fb9c17812e9b076327 Mon Sep 17 00:00:00 2001 From: Christian Melendez Date: Thu, 10 Nov 2022 23:30:25 +0100 Subject: [PATCH 1/2] Fixed problems with the CFN for tracking Spot interruptions --- .../cloudwatchlogs.yaml | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/workshops/track-spot-interruptions/cloudwatchlogs.yaml b/workshops/track-spot-interruptions/cloudwatchlogs.yaml index 6085f322..5849ed33 100644 --- a/workshops/track-spot-interruptions/cloudwatchlogs.yaml +++ b/workshops/track-spot-interruptions/cloudwatchlogs.yaml @@ -21,7 +21,6 @@ Resources: detail-type: - EC2 Instance Rebalance Recommendation State: ENABLED - RoleArn: !GetAtt CloudWatchLogRole.Arn Targets: - Arn: Fn::GetAtt: @@ -40,7 +39,6 @@ Resources: detail-type: - EC2 Spot Instance Interruption Warning State: ENABLED - RoleArn: !GetAtt CloudWatchLogRole.Arn Targets: - Arn: Fn::GetAtt: @@ -56,25 +54,33 @@ Resources: Ref: CloudWatchLogGroupName RetentionInDays: Ref: CloudWatchLogGroupRetentionPeriodDays - CloudWatchLogRole: - Type: AWS::IAM::Role + LogGroupForEventsPolicy: + Type: AWS::Logs::ResourcePolicy Properties: - AssumeRolePolicyDocument: - Version: 2012-10-17 - Statement: - - Effect: Allow - Principal: - Service: events.amazonaws.com - Action: 'sts:AssumeRole' - Policies: - - PolicyName: "AllowLogging" - PolicyDocument: - Version: '2012-10-17' - Statement: - - Effect: "Allow" - Action: - - 'logs:*' - Resource: "*" + PolicyName: EventBridgeToCWLogsPolicy + PolicyDocument: !Sub > + { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "EventBridgetoCWLogsCreateLogStreamPolicy", + "Effect": "Allow", + "Principal": { + "Service": [ + "events.amazonaws.com", + "delivery.logs.amazonaws.com" + ] + }, + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": [ + "${CloudWatchLogGroup.Arn}" + ] + } + ] + } Outputs: CloudWatchLogGroupName: From 4c655c8f133ee23dc8c375b31b4a13d237b6ef0a Mon Sep 17 00:00:00 2001 From: Christian Melendez Date: Thu, 10 Nov 2022 23:36:22 +0100 Subject: [PATCH 2/2] Updated the version of the EC2 Instance Selector CLI --- .../selecting_instance_types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/running_spark_apps_with_emr_on_spot_instances/selecting_instance_types.md b/content/running_spark_apps_with_emr_on_spot_instances/selecting_instance_types.md index 0e58a89a..de7264e1 100644 --- a/content/running_spark_apps_with_emr_on_spot_instances/selecting_instance_types.md +++ b/content/running_spark_apps_with_emr_on_spot_instances/selecting_instance_types.md @@ -17,7 +17,7 @@ types with sufficient number of vCPUs and RAM. Let's first install amazon-ec2-instance-selector on Cloud9 IDE: ``` -curl -Lo ec2-instance-selector https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.3.2/ec2-instance-selector-`uname | tr '[:upper:]' '[:lower:]'`-amd64 && chmod +x ec2-instance-selector +curl -Lo ec2-instance-selector https://github.com/aws/amazon-ec2-instance-selector/releases/download/v2.4.0/ec2-instance-selector-`uname | tr '[:upper:]' '[:lower:]'`-amd64 && chmod +x ec2-instance-selector sudo mv ec2-instance-selector /usr/local/bin/ ec2-instance-selector --version ```