Skip to content
This repository was archived by the owner on Mar 15, 2026. It is now read-only.
Open
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
10 changes: 8 additions & 2 deletions aws_lambda/aws_lambda.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -436,7 +436,7 @@ def pip_install_to_target(path, use_requirements=False, local_package=None):
def get_role_name(region, account_id, role):
"""Shortcut to insert the `account_id` and `role` into the iam string."""
prefix = ARN_PREFIXES.get(region, 'aws')
return 'arn:{0}:iam::{1}:role/{2}'.format(prefix, account_id, role)
return None if role == "noRoleSet" else 'arn:{0}:iam::{1}:role/{2}'.format(prefix, account_id, role)


def get_account_id(aws_access_key_id, aws_secret_access_key, region=None):
Expand DownExpand Up@@ -472,7 +472,7 @@ def create_function(cfg, path_to_zip_file, *use_s3, **s3_file):
)
role = get_role_name(
cfg.get('region'), account_id,
cfg.get('role', 'lambda_basic_execution'),
cfg.get('role', 'noRoleSet'),
)

client = get_client(
Expand DownExpand Up@@ -517,6 +517,9 @@ def create_function(cfg, path_to_zip_file, *use_s3, **s3_file):
'Publish': True,
}

if not role:
kwargs.pop('Role')

if 'environment_variables' in cfg:
kwargs.update(
Environment={
Expand DownExpand Up@@ -584,6 +587,9 @@ def update_function(cfg, path_to_zip_file, *use_s3, **s3_file):
'SecurityGroupIds': cfg.get('security_group_ids', []),
},
}

if not role:
kwargs.pop('Role')

if 'environment_variables' in cfg:
kwargs.update(
Expand Down