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

543
Vistas
How to configure AWS Cloudwatch Events for the AssumeRole event (in order to trigger SNS notifications)

I am trying to configure a Cloudwatch Event Rule (to trigger an SNS notification) for whenever someone assumes a particular role:

{
  "detail": {
    "eventName": [
      "AssumeRole"
    ],
    "eventSource": [
      "sts.amazonaws.com"
    ],
    "requestParameters": {
      "roleArn": [
        "arn:aws:iam::0000:role/the_role_name"
      ]
    }
  },
  "detail-type": [
    "AWS API Call via CloudTrail"
  ]
}

Where 0000 is the account id and the_role_name is the role I want to alert on.

This is failing to trigger any notification, however when I search in Cloudtrail Insights for the events:

filter eventName = 'AssumeRole'
| filter requestParameters.roleArn =~ 'the_role_name'
| sort @timestamp desc
| display @timestamp, requestParameters.roleSessionName, eventName, requestParameters.roleArn, userAgent, sourceIPAddress

I DO get results that SHOULD have triggered the rule:

requestParameters.roleSessionName eventName   requestParameters.roleArn
my_username                       AssumeRole  arn:aws:iam::0000:role/the_role_name
...

For the sake of trying to dumb things down and catch a broader set of events, I also tried the following Rule (which would catch all AssumeRole events to any role):

{
  "detail": {
    "eventName": [
      "AssumeRole"
    ]
  },
  "detail-type": [
    "AWS API Call via CloudTrail"
  ]
}

This rule also is failing to trigger.

Does anyone have ideas on how to configure Cloudwatch Event Rules to trigger on AssumeRole events?

I read through this related question (which is trying to achieve something similar), but it did not have a solution: AWS CloudWatch Events trigger SNS on STS role assuming for cross account

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

0

First of all make sure whether the event is invoked or not by checking the monitoring metrics for the rule. It is possible that it is triggered, but it fails to invoke the target. In this case, you should check your IAM policies.

If it is not triggered, there could be issues with trail delivery to Cloudwatch Logs. Make sure that you created a trail in the same region, which delivers events to Cloudwatch Logs.

I've the following rule in us-east-1 region, which works fine:

{
  "detail-type": [
    "AWS API Call via CloudTrail"
  ],
  "detail": {
    "eventSource": [
      "sts.amazonaws.com"
    ],
    "eventName": [
      "AssumeRole"
    ]
  },
  "source": [
    "aws.sts"
  ]
}
over 4 years ago · Santiago Trujillo Denunciar

0

According an an AWS Support agent I was speaking with yesterday, and also indicated by the linked documents, Eventbridge Rules (formerly Cloudwatch Event Rules) unfortunately do not support STS events.

What's perplexing about this and might lead you down a wrong path, as it did me, is that the sts test-event-pattern api will in fact validate your event against a valid pattern and give no indication that it's an unsupported service.

Hopefully AWS adds STS event support in the future.

https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-service-event.html

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