{
"source": [
"aws.ec2"
]
} |
Thanks for your inputs Kapil! Just a couple more questions
inline.
its always good to start with the why, ec2 the service and ec2 as a vm are two very different things. so you want to monitor state/tags/security changes on all vms or all changes to the security groups and tags across the entire service? I'm going to assume the former.
the ec2-instance-state is a specific event stream documented per cloud watch events as instance state change notification (starting, stopped, pending, etc).
if you want a policy to be invoked in response to api events, use a mode: cloudtrail and specify the api calls your interested in being notified on, you'll need to use the full syntax per the custodian docs (ids, event, source) per each api call.
Great, I was hoping to achieve this via the cloudtrail mode as
you mention. I wasn't however able to find the relevant bits of
documentation or example policies to carry this out. Can you point
me to something?
an alternative is to use mode: config-rule to provision as a config rule, the latency is higher (minutes vs seconds), but its simpler configuration if your just looking for some sort of catch all changes to instances.
Likewise here, any examples ?
the ipaddress warning isn't material, I think its todo with python3.8
--
You received this message because you are subscribed to the Google Groups "cloud-custodian" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-custodi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-custodian/0fc0d274-dd83-40f6-a1bd-cdeda05ee8c4%40googlegroups.com.
Ok, I figured the policy should look something like below
policies:
- name: ec2-attribute-relay
resource: aws.ec2
mode:
type: cloudtrail
role: arn:aws:iam::account:role/lambda-role
events:
- source: ec2.amazonaws.com
event: CreateTags
ids: "requestParameters.groupId"
- source: ec2.amazonaws.com
event: DeleteTags
ids: "requestParameters.groupId"
actions:
- type: invoke-lambda
function: my-lambda-function
Ok, I figured the policy should look something like below
policies:
- name: ec2-attribute-relay
resource: aws.ec2
mode:
type: cloudtrail
role: arn:aws:iam::account:role/lambda-role
events:
- source: ec2.amazonaws.com
event: CreateTags
ids: "requestParameters.groupId"
- source: ec2.amazonaws.com
event: DeleteTags
ids: "requestParameters.groupId"
actions:
- type: invoke-lambda
function: my-lambda-function
Sure enough, the event gets logged in the associated cloud watch logs but the custom lambda function("my-lambda-function") doesn't seem to get invoked. I'll investigate this further.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-custodian+unsubscribe@googlegroups.com.