FunctionAttributes

class aws_cdk.aws_lambda.FunctionAttributes(*, function_arn, role=None, same_environment=None, security_group=None, security_group_id=None)

Bases: object

Represents a Lambda function defined outside of this stack.

Parameters
  • function_arn (str) – The ARN of the Lambda function. Format: arn::lambda:::function:

  • role (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 the env property, 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 (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.

  • security_group_id (Optional[str]) – (deprecated) Id of the security group of this Lambda, if in a VPC. This needs to be given in order to support allowing connections to this Lambda.

Attributes

function_arn

The ARN of the Lambda function.

Format: arn::lambda:::function:

Return type

str

role

The IAM execution role associated with this function.

If the role is not specified, any role-related operations will no-op.

Return type

Optional[IRole]

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 env property, 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.

Return type

Optional[bool]

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.

Return type

Optional[ISecurityGroup]

security_group_id

(deprecated) Id of the security group of this Lambda, if in a VPC.

This needs to be given in order to support allowing connections to this Lambda.

Deprecated

use securityGroup instead

Stability

deprecated

Return type

Optional[str]