How to get aws lambda function name at CLI?

aws lambda list-functions query
aws cli invoke lambda function example
aws lambda get-function-configuration
aws cli lambda layer
aws lambda update-function-code
aws cli lambda create-function
aws cli get lambda permissions
aws cli disable lambda

I can get the details with

$ aws lambda get-function --function-name random_number
{
    "Configuration": {
        "FunctionName": "random_number",
        "FunctionArn": "arn:aws:lambda:us-east-2:193693970645:function:random_number",
        "Runtime": "ruby2.5",
        "Role": "arn:aws:iam::193693970645:role/service-role/random_number-role-8cy8a1a7",
        ...

But how can get just a couple of fields like function name ?

I tried:

$ aws lambda get-function --function-name random_number --query "Configuration[*].[FunctionName]"

but I get null

Your overall approach is correct, you just need to adjust the query:

$ aws lambda get-function --function-name random_number \
      --query "Configuration.FunctionName" --output text

I also added a parameter to convert the result to text, which makes processing a bit easier.

get-function-configuration — AWS CLI 1.18.92 Command Reference, The name of the Lambda function, version, or alias. Name formats. Function name - my-function (name-only), my-function:v1 (� Your overall approach is correct, you just need to adjust the query: $ aws lambda get-function --function-name random_number \ --query "Configuration.FunctionName" --output text I also added a parameter to convert the result to text, which makes processing a bit easier.

Here is a simple awk (standard Linux gnu awk) script that does the trick: Extract the values of quoted field #3, only for line having /FunctionName/.

awk 'BEGIN {FPAT="\"[^\"]+"}/FunctionName/{print substr($3,2)}'

Piped with your initial command:

$ aws lambda get-function --function-name random_number | awk 'BEGIN {FPAT="\"[^\"]+"}/FunctionName/{print substr($3,2)}'

Using AWS Lambda with the AWS Command Line Interface, https://docs.aws.amazon.com › cli › latest › reference › lambda › list-functi AWS Lambda function & CLI. Apart from using the AWS Lambda console directly to create or update the functions, AWS provides a very easy way to do the same stuff using Command Line Interface (CLI) as well. In this blog, we’ll learn the process to create a new Lambda function written in Java using CLI commands.

One way to achieve that is by using jq. therefore, the output must be JSON.

From the docs :

jq is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.

Usage example :

aws lambda get-function --function-name test --output json | jq -r '.Configuration.FunctionName'

list-functions — AWS CLI 1.18.89 Command Reference, Returns a list of Lambda functions, with the version-specific configuration of each. Lambda returns up The JSON string follows the format provided by --generate- cli-skeleton. If other The function's Amazon Resource Name (ARN). Runtime� The following code snippet shows how, for example, you can get your AWS Account ID in your Lambda function using the AWS CLI. To use this code snippet, you must include the AWS CLI into the deployment package of your Lambda function.

Use get-function-configuration as in the following:

aws lambda get-function-configuration --function-name MyFunction --query "[FunctionName]"

invoke — AWS CLI 1.18.90 Command Reference, AWS CLI version 2, the latest major version of AWS CLI, is now stable and Invokes a Lambda function. For either invocation type, you can find more information in the execution log and The name of the Lambda function, version, or alias. get-function --function-name <value> [--qualifier <value>] [--cli-input-json <value>] [--generate-cli-skeleton <value>] Options Included--function-name − Name of the AWS Lambda function. You can also specify Amazon Resource Name of the function.--qualifier(string) − Optional. Function version can be used to get the details of the function.

get-alias — AWS CLI 1.18.91 Command Reference, The name of the Lambda function. Name formats. Function name - MyFunction . Function ARN - arn:aws:lambda:us-west-� $ aws lambda list-functions --max-items 10 --starting-token eyJNYXJrZXIiOiBudWxsLCAiYm90b190cnVuY2F0ZV9hbW91bnQiOiAxMH0= Retrieve a Lambda function. The Lambda CLI get-function command returns Lambda function metadata and a presigned URL that you can use to download the function's deployment package.

create-function — AWS CLI 1.18.86 Command Reference, The Amazon Resource Name (ARN) of the function's execution role. --handler ( string). The name of the method within your code that Lambda calls to execute� Why not try aws lambda get-function --function-name abc. This will return ResourceNotFoundException if the function does not exist. – krishna_mee2004 Jun 10 '19 at 19:48 Either what @krishna_mee2004 suggested or you can list your functions to loop through and find a function if it exists, etc. aws lambda list-functions – Woodrow Jun 10 '19

lambda — AWS CLI 1.18.92 Command Reference, AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended The AWS Lambda Developer Guide provides additional information. get-function-event-invoke-config � get-layer-version � get-layer- version-by-arn� Creating the AWS Lambda Function – ParentFunction. Head over to the Lambda Function page and click on Create New Lambda function. I am calling this lambda function – “ParentFunction”. Choose the run time as Python 3.8 and assign the InvokeOtherLambdaRole role that we just created in the previous step.