Skip to content
This repository was archived by the owner on Feb 3, 2023. It is now read-only.

Commit 17aa7d8

Browse files
committed
update for python 3.6
1 parent 0c2b725 commit 17aa7d8

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ TBD
6161
"Action": [
6262
"logs:CreateLogGroup",
6363
"logs:CreateLogStream",
64-
"logs:PutLogEvents"
65-
],
66-
"Resource": "arn:aws:logs:*:*:*"
67-
},
68-
{
69-
"Effect": "Allow",
70-
"Action": [
64+
"logs:PutLogEvents",
7165
"ec2:CreateSnapshot",
7266
"ec2:CreateTags",
7367
"ec2:DeleteSnapshot",
@@ -90,7 +84,7 @@ TBD
9084
* Enable trigger
9185
* Configure function
9286
* Enter name
93-
* Select "Python 2.7" from the Runtime dropdown
87+
* Select "Python 3.6" from the Runtime dropdown
9488
* Copy the source code from ebs-backup.py to code window
9589
* Check that Handler is "lambda_function.lambda_handler"
9690
* Choose the previously created IAM role

ebs-backup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ def backup_instance(instance):
7474
'InstanceName': instance_name,
7575
'DeleteOn': delete_date_fmt
7676
}
77-
tag_list = map(lambda (k, v): {'Key': k, 'Value': v}, list(tags.items()))
77+
tag_list = list(map(lambda kv: {'Key': kv[0], 'Value': kv[1]}, list(tags.items())))
7878
client.create_tags(Resources=snapshot_ids, Tags=tag_list)
7979

8080

8181
def parse_config(instance, instance_name, config):
8282
try:
83-
backup_configuration = map(int, config.split(','))
83+
backup_configuration = list(map(int, config.split(',')))
8484
if any(i < 0 for i in backup_configuration):
8585
raise ValueError('Values must be >= 0')
8686
return backup_configuration

terraform/aws-lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ resource "aws_lambda_function" "lambda_ebs_backup" {
5757
role = "${aws_iam_role.lambda_ebs_backup.arn}"
5858
handler = "ebs-backup.lambda_handler"
5959
source_code_hash = "${base64sha256(file("ebs-backup.zip"))}"
60-
runtime = "python2.7"
60+
runtime = "python3.6"
6161
timeout = 60
6262
}
6363

0 commit comments

Comments
 (0)