Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cleanup-imported-ebs-snapshots/cloudformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Resources:
Properties:
FunctionName: elastio-cleanup-imported-ebs-snapshots
Description: "A Lambda function to delete EBS snapshots tagged with elastio:imported-to-rp"
Runtime: nodejs20.x
Runtime: nodejs24.x
Handler: index.handler
Role: !GetAtt LambdaExecutionRole.Arn
Events:
Expand Down
42 changes: 21 additions & 21 deletions cleanup-leftover-ebs-volumes/cleanup-elastio-ebs-vols.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Resources:
EBSVolumeCleanupFunction:
Type: 'AWS::Serverless::Function'
Type: "AWS::Serverless::Function"
Properties:
FunctionName: EBSVolumeCleanupFunction
Description: 'A Lambda function to delete un-attached EBS volumes older than 24 hours with the elastio:resource tag'
Runtime: nodejs20.x
Description: "A Lambda function to delete un-attached EBS volumes older than 24 hours with the elastio:resource tag"
Runtime: nodejs24.x
Handler: index.handler
Role: !GetAtt LambdaExecutionRole.Arn
InlineCode: |-
Expand Down Expand Up @@ -68,44 +68,44 @@ Resources:
Schedule1:
Type: Schedule
Properties:
Schedule: 'rate(1 hour)'
Schedule: "rate(1 hour)"
LambdaExecutionRole:
Type: 'AWS::IAM::Role'
Type: "AWS::IAM::Role"
Properties:
RoleName: LambdaExecutionRole
AssumeRolePolicyDocument:
Version: '2012-10-17'
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
Action:
- 'sts:AssumeRole'
- "sts:AssumeRole"
Policies:
- PolicyName: EC2EBSVolumePolicy
PolicyDocument:
Version: '2012-10-17'
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- 'ec2:DescribeVolumes'
Resource: '*'
- "ec2:DescribeVolumes"
Resource: "*"
- Effect: Allow
Action:
- 'ec2:DeleteVolume'
Resource: '*'
- "ec2:DeleteVolume"
Resource: "*"
Condition:
StringLike:
'aws:ResourceTag/elastio:resource': '*'
"aws:ResourceTag/elastio:resource": "*"
- Effect: Allow
Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource: 'arn:aws:logs:*:*:*'
- "logs:CreateLogGroup"
- "logs:CreateLogStream"
- "logs:PutLogEvents"
Resource: "arn:aws:logs:*:*:*"
EBSVolumeCleanupLogGroup:
Type: 'AWS::Logs::LogGroup'
Type: "AWS::Logs::LogGroup"
Properties:
LogGroupName: '/aws/lambda/EBSVolumeCleanupFunction'
LogGroupName: "/aws/lambda/EBSVolumeCleanupFunction"
RetentionInDays: 7