Class FunctionAttributes
Represents a Lambda function defined outside of this stack.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Lambda
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class FunctionAttributes : Object, IFunctionAttributes
Syntax (vb)
Public Class FunctionAttributes
Inherits Object
Implements IFunctionAttributes
Remarks
ExampleMetadata: infused
Examples
var fn = Function.FromFunctionAttributes(this, "Function", new FunctionAttributes {
FunctionArn = "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.
SameEnvironment = 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.
SkipPermissions = true
});
Synopsis
Constructors
FunctionAttributes() |
Properties
Architecture | The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64). |
FunctionArn | The ARN of the Lambda function. |
Role | The IAM execution role associated with this function. |
SameEnvironment | Setting this property informs the CDK that the imported function is in the same environment as the stack. |
SecurityGroup | The security group of this Lambda, if in a VPC. |
SkipPermissions | Setting this property informs the CDK that the imported function ALREADY HAS the necessary permissions for what you are trying to do. |
Constructors
FunctionAttributes()
public FunctionAttributes()
Properties
Architecture
The architecture of this Lambda Function (this is an optional attribute and defaults to X86_64).
public Architecture Architecture { get; set; }
Property Value
Remarks
Default: - Architecture.X86_64
FunctionArn
The ARN of the Lambda function.
public string FunctionArn { get; set; }
Property Value
System.String
Remarks
Format: arn:<partition>:lambda:<region>:<account-id>:function:<function-name>
Role
The IAM execution role associated with this function.
public IRole Role { get; set; }
Property Value
Remarks
If the role is not specified, any role-related operations will no-op.
SameEnvironment
Setting this property informs the CDK that the imported function is in the same environment as the stack.
public Nullable<bool> SameEnvironment { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
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
.
SecurityGroup
The security group of this Lambda, if in a VPC.
public ISecurityGroup SecurityGroup { get; set; }
Property Value
Remarks
This needs to be given in order to support allowing connections to this Lambda.
SkipPermissions
Setting this property informs the CDK that the imported function ALREADY HAS the necessary permissions for what you are trying to do.
public Nullable<bool> SkipPermissions { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
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