Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

554
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda