FunctionAttributesο
- class aws_cdk.aws_lambda.FunctionAttributes(*, function_arn, architecture=None, role=None, same_environment=None, security_group=None, skip_permissions=None, tenancy_config=None)ο
Bases:
objectRepresents a Lambda function defined outside of this stack.
- Parameters:
function_arn (
str) β The ARN of the Lambda function. Format: arn::lambda:::function:architecture (
Optional[Architecture]) β The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64). Default: - Architecture.X86_64role (
Optional[IRole]) β The IAM execution role associated with this function. If the role is not specified, any role-related operations will no-op.same_environment (
Optional[bool]) β Setting this property informs the CDK that the imported function is in the same environment as the stack. This affects certain behaviours such as, whether this functionβs permission can be modified. When not configured, the CDK attempts to auto-determine this. For environment agnostic stacks, i.e., stacks where the account is not specified with theenvproperty, this is determined to be false. Set this to property ONLY IF the imported function is in the same account as the stack itβs imported in. Default: - depends: true, if the Stack is configured with an explicitenv(account and region) and the account is the same as this function. For environment-agnostic stacks this will default tofalse.security_group (
Optional[ISecurityGroup]) β The security group of this Lambda, if in a VPC. This needs to be given in order to support allowing connections to this Lambda.skip_permissions (
Optional[bool]) β Setting this property informs the CDK that the imported function ALREADY HAS the necessary permissions for what you are trying to do. When not configured, the CDK attempts to auto-determine whether or not additional permissions are necessary on the function when grant APIs are used. If the CDK tried to add permissions on an imported lambda, it will fail. Set this property ONLY IF you are committing to manage the imported functionβs permissions outside of CDK. You are acknowledging that your CDK code alone will have insufficient permissions to access the imported function. Default: falsetenancy_config (
Optional[TenancyConfig]) β The tenancy configuration of this Lambda Function. Default: - Tenant isolation is not enabled
- ExampleMetadata:
infused
Example:
fn = lambda_.Function.from_function_attributes(self, "Function", function_arn="arn:aws:lambda:us-east-1:123456789012:function:MyFn", # The following are optional properties for specific use cases and should be used with caution: # Use Case: imported function is in the same account as the stack. This tells the CDK that it # can modify the function's permissions. same_environment=True, # Use Case: imported function is in a different account and user commits to ensuring that the # imported function has the correct permissions outside the CDK. skip_permissions=True )
Attributes
- architectureο
The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).
- Default:
Architecture.X86_64
- function_arnο
The ARN of the Lambda function.
Format: arn::lambda:::function:
- roleο
The IAM execution role associated with this function.
If the role is not specified, any role-related operations will no-op.
- same_environmentο
Setting this property informs the CDK that the imported function is in the same environment as the stack.
This affects certain behaviours such as, whether this functionβs permission can be modified. When not configured, the CDK attempts to auto-determine this. For environment agnostic stacks, i.e., stacks where the account is not specified with the
envproperty, this is determined to be false.Set this to property ONLY IF the imported function is in the same account as the stack itβs imported in.
- Default:
depends: true, if the Stack is configured with an explicit
env(account and region) and the account is the same as this function.
For environment-agnostic stacks this will default to
false.
- security_groupο
The security group of this Lambda, if in a VPC.
This needs to be given in order to support allowing connections to this Lambda.
- skip_permissionsο
Setting this property informs the CDK that the imported function ALREADY HAS the necessary permissions for what you are trying to do.
When not configured, the CDK attempts to auto-determine whether or not additional permissions are necessary on the function when grant APIs are used. If the CDK tried to add permissions on an imported lambda, it will fail.
Set this property ONLY IF you are committing to manage the imported functionβs permissions outside of CDK. You are acknowledging that your CDK code alone will have insufficient permissions to access the imported function.
- Default:
false
- tenancy_configο
The tenancy configuration of this Lambda Function.
- Default:
Tenant isolation is not enabled