permissions
Creates, updates, deletes or gets a permission resource or lists permissions in a region
Overview
| Name | permissions |
| Type | Resource |
| Description | The To grant permission to another account, specify the account ID as the |
| Id | awscc.lambda.permissions |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
function_name | string | The name or ARN of the Lambda function, version, or alias.Name formats+ Function name – my-function (name-only), my-function:v1 (with alias).+ Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function.+ Partial ARN – 123456789012:function:my-function.You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length. |
action | string | The action that the principal can use on the function. For example, lambda:InvokeFunction or lambda:GetFunction. |
event_source_token | string | For Alexa Smart Home functions, a token that the invoker must supply. |
function_url_auth_type | string | The type of authentication that your function URL uses. Set to AWS_IAM if you want to restrict access to authenticated users only. Set to NONE if you want to bypass IAM authentication to create a public endpoint. For more information, see Security and auth model for Lambda function URLs. |
source_arn | string | For AWS-services, the ARN of the AWS resource that invokes the function. For example, an Amazon S3 bucket or Amazon SNS topic.Note that Lambda configures the comparison using theStringLike operator. |
source_account | string | For AWS-service, the ID of the AWS-account that owns the resource. Use this together with SourceArn to ensure that the specified account owns the resource. It is possible for an Amazon S3 bucket to be deleted by its owner and recreated by another account. |
principal_org_id | string | The identifier for your organization in AOlong. Use this to grant permissions to all the AWS-accounts under this organization. |
id | string | |
principal | string | The AWS-service, AWS-account, IAM user, or IAM role that invokes the function. If you specify a service, use SourceArn or SourceAccount to limit who can invoke the function through that service. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
function_name | string | The name or ARN of the Lambda function, version, or alias.Name formats+ Function name – my-function (name-only), my-function:v1 (with alias).+ Function ARN – arn:aws:lambda:us-west-2:123456789012:function:my-function.+ Partial ARN – 123456789012:function:my-function.You can append a version number or alias to any of the formats. The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length. |
id | string | |
region | string | AWS region. |
For more information, see AWS::Lambda::Permission.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | permissions | INSERT | FunctionName, Action, Principal, region |
delete_resource | permissions | DELETE | Identifier, region |
list_resources | permissions_list_only | SELECT | region |
get_resource | permissions | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual permission.
SELECT
region,
function_name,
action,
event_source_token,
function_url_auth_type,
source_arn,
source_account,
principal_org_id,
id,
principal
FROM awscc.lambda.permissions
WHERE
region = '{{ region }}' AND
Identifier = '{{ function_name }}|{{ id }}';
Lists all permissions in a region.
SELECT
region,
function_name,
id
FROM awscc.lambda.permissions_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new permission resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.lambda.permissions (
FunctionName,
Action,
Principal,
region
)
SELECT
'{{ function_name }}',
'{{ action }}',
'{{ principal }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.lambda.permissions (
FunctionName,
Action,
EventSourceToken,
FunctionUrlAuthType,
SourceArn,
SourceAccount,
PrincipalOrgID,
Principal,
region
)
SELECT
'{{ function_name }}',
'{{ action }}',
'{{ event_source_token }}',
'{{ function_url_auth_type }}',
'{{ source_arn }}',
'{{ source_account }}',
'{{ principal_org_id }}',
'{{ principal }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: permission
props:
- name: function_name
value: '{{ function_name }}'
- name: action
value: '{{ action }}'
- name: event_source_token
value: '{{ event_source_token }}'
- name: function_url_auth_type
value: '{{ function_url_auth_type }}'
- name: source_arn
value: '{{ source_arn }}'
- name: source_account
value: '{{ source_account }}'
- name: principal_org_id
value: '{{ principal_org_id }}'
- name: principal
value: '{{ principal }}'
DELETE example
/*+ delete */
DELETE FROM awscc.lambda.permissions
WHERE
Identifier = '{{ function_name }}|{{ id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the permissions resource, the following permissions are required:
- Read
- Create
- List
- Delete
lambda:GetPolicy
lambda:AddPermission
lambda:GetPolicy
lambda:RemovePermission