interface LayerVersionPermission
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.LayerVersionPermission |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#LayerVersionPermission |
Java | software.amazon.awscdk.services.lambda.LayerVersionPermission |
Python | aws_cdk.aws_lambda.LayerVersionPermission |
TypeScript (source) | aws-cdk-lib » aws_lambda » LayerVersionPermission |
Identification of an account (or organization) that is allowed to access a Lambda Layer Version.
Example
const layer = new lambda.LayerVersion(stack, 'MyLayer', {
code: lambda.Code.fromAsset(path.join(__dirname, 'layer-code')),
compatibleRuntimes: [lambda.Runtime.NODEJS_LATEST],
license: 'Apache-2.0',
description: 'A layer to test the L2 construct',
});
// To grant usage by other AWS accounts
layer.addPermission('remote-account-grant', { accountId: awsAccountId });
// To grant usage to all accounts in some AWS Ogranization
// layer.grantUsage({ accountId: '*', organizationId });
new lambda.Function(stack, 'MyLayeredLambda', {
code: new lambda.InlineCode('foo'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_LATEST,
layers: [layer],
});
Properties
Name | Type | Description |
---|---|---|
account | string | The AWS Account id of the account that is authorized to use a Lambda Layer Version. |
organization | string | The ID of the AWS Organization to which the grant is restricted. |
accountId
Type:
string
The AWS Account id of the account that is authorized to use a Lambda Layer Version.
The wild-card '*'
can be
used to grant access to "any" account (or any account in an organization when organizationId
is specified).
organizationId?
Type:
string
(optional)
The ID of the AWS Organization to which the grant is restricted.
Can only be specified if accountId
is '*'