Skip to content

Commit 388d47b

Browse files
get function name from env variable
1 parent 72b6f14 commit 388d47b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

aws_lambda/aws_lambda.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ def create_function(cfg, path_to_zip_file):
294294
client = get_client('lambda', aws_access_key_id, aws_secret_access_key,
295295
cfg.get('region'))
296296

297+
function_name = os.environ.get('LAMBDA_FUNCTION_NAME') or cfg.get('function_name')
298+
print('Creating lambda function with name: {}'.format(function_name))
297299
client.create_function(
298-
FunctionName=cfg.get('function_name'),
300+
FunctionName=function_name,
299301
Runtime=cfg.get('runtime', 'python2.7'),
300302
Role=role,
301303
Handler=cfg.get('handler'),
@@ -306,7 +308,7 @@ def create_function(cfg, path_to_zip_file):
306308
Environment={
307309
'Variables': {
308310
key.strip('LAMBDA_'): value
309-
for key, value in os.envinron.items()
311+
for key, value in os.environ.items()
310312
if key.startswith('LAMBDA_')
311313
}
312314
},

0 commit comments

Comments
 (0)