Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Find who invoked AWS Lambda function

I have Lambda function written in Python 3.7.

This Lambda function is invoked by some users through AWS CLI using:

  aws lambda invoke --function-name stXXX-XXX out --log-type Tail

I want to capture who invoked my Lambda function through AWS CLI in my code.

As there any way I can find who invoke my Lambda function in python boto3 code?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Yes. Generally for that you would have to enable logging data event in CloudTrail:

  • Logging AWS Lambda API calls with AWS CloudTrail

By default logging of lambda invocations is disabled as it can lead to a lot of logs.

The log event contains information about what IAM user or role invoked the function. For example:

      "userIdentity": {
        "type": "IAMUser",
        "principalId": "A1B2C3D4E5F6G7EXAMPLE",
        "arn": "arn:aws:iam::999999999999:user/myUserName",
        "accountId": "999999999999",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "userName": "myUserName"
      },
over 4 years ago · Santiago Trujillo Denunciar

0

It appears that your situation is:

  • You have an AWS Lambda function that Starts an Amazon EC2 instance
  • You want the Lambda function to detect who has made the request and then confirm that they are on an authorization list before starting the Amazon EC2 instance

Unfortunately, information about 'who' invoked the Lambda function (or, more specifically, which IAM entity invoked it) is not available.

The AWS Lambda context object in Python does not provide this information to the Lambda function.

A "more correct" way would be to control the IAM permissions that determine who can invoke this Lambda function. Only correctly authorized persons should have permission to call lambda:Invoke on this function. Similarly, it is important to limit who can use iam:PassRole on the IAM Role used by this function, since it has permissions to start the EC2 instance and it could be used on other functions unless PassRole is restricted.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda