Skip to content

Commit

Permalink
Merge pull request awslabs#222 from christianhxc/CMP406
Browse files Browse the repository at this point in the history
Updating the CFN for Tracking Spot notifications and use the latest EC2 Instance Selector CLI version
  • Loading branch information
jagpk authored Nov 11, 2022
2 parents 4784739 + 4c655c8 commit 97b1b86
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
46 changes: 26 additions & 20 deletions workshops/track-spot-interruptions/cloudwatchlogs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Resources:
detail-type:
- EC2 Instance Rebalance Recommendation
State: ENABLED
RoleArn: !GetAtt CloudWatchLogRole.Arn
Targets:
- Arn:
Fn::GetAtt:
Expand All @@ -40,7 +39,6 @@ Resources:
detail-type:
- EC2 Spot Instance Interruption Warning
State: ENABLED
RoleArn: !GetAtt CloudWatchLogRole.Arn
Targets:
- Arn:
Fn::GetAtt:
Expand All @@ -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:
Expand Down

0 comments on commit 97b1b86

Please sign in to comment.