I am having an existing Cloudformation template to create a Codebuild, and I want to send a notification mail by updating the template when make a Codebuild fails. How to make a change in such a way ?
I'm completely new to Cloudformation, and it would be better if I get some inputs regarding the same. Thanks!
You can create a SNS topic in AWS for the notifications regarding the codebuild/codepipeline triggers. you can also manage what will trigger the SNS to send the email ( such as build fail/success, etc).
Please refer this AWS document for your reference:
https://docs.aws.amazon.com/codebuild/latest/userguide/sample-build-notifications.html
If I understood your question correctly. You want to update the cloud formation template if the build fails on codebuild.
You can get notified from codebuild by creating a notification rule on build failures.It will send messages to SNS. This message can be consumed with lambda to update the cloud formation template. There are many
ways as notification to SNS can be consumed.
More information here
Related
I have a lambda function that notifies an SNS topic.
It currently sends an email each time I invoke the function so the lambda, the SNS piece and the email subscription are all working ok.
Now I want a Slack Integration.
I've created a channel called aws_int but I can't get it to receive the notification.
I am stuck on the need to 'verify the subscription'. I don't see how I would do this in the https connection to slack.
I don't understand how to do it manually using the console in aws because all the documentation keeps referring to using the 'Subscription Confirmation URL'
I can't find what that is.
but I cannot find what that is.
I found a post talking about the JSON being invalid: Confirming AWS SNS Topic Subscription for Slack Webhook but I don't understand how I would use that, maybe I could use Postman but I am not sure exactly how to format that POST.
So how can I integrate Slack and aws for an SNS topic, specifically how can I do the confirmation (which is required in order to activate it). This has to be a common need!
If I use the hook URL I get
Everything I am trying is just stacking up more Pending Confirmations, which btw I cannot delete...
Here's my postman attempt...
You really DON'T need Lambda. Just SNS and SLACK are enough.
I found a way to integrate AWS SNS with slack WITHOUT AWS Lambda or AWS chatbot. With this approach you can confirm the subscription easily.
Follow the video which show all the step clearly.
https://www.youtube.com/watch?v=CszzQcPAqNM
Steps to follow:
Create slack channel or use existing channel
Create a work flow with selecting Webhook
Create a variable name as "SubscribeURL". The name
is very important
Add the above variable in the message body of the
workflow Publish the workflow and get the url
Add the above Url as subscription of the SNS You will see the subscription URL in the
slack channel
Follow the URl and complete the subscription
Come back to the work flow and change the "SubscribeURL" variable to "Message"
The publish the
message in SNS. you will see the message in the slack channel.
It doesn't look like there is a way to confirm an SNS subscription to a Slack endpoint (email, webhook, whatever). If you want to use SNS as a decoupling layer, you'll need to add a lambda into the system, which can handle the confirmation process.
Lambda -> webhook -> SNS -> Lambda -> webhook -> Slack
Confirming AWS SNS Topic Subscription for Slack Webhook has some more information about this.
I would recommend just using the Lambda to send a message to slack, either calling another dedicated lambda, or just internally to the original one. There's a good tutorial here. If you really want to use SNS, then you could use your original lambda to trigger SNS, then have a new slack-dedicated lambda subscribe to the SNS topic.
Usecase
I am having a cross-account codepipeline where my codecommit in one account and my pipeline is in another account. My codecommit is source for the pipeline means any commit in that will trigger the pipeline. Codecommit is shared among 50 developers.
Codepipeline Features
I know the codepipeline will trigger emails based on cloudwatch events rules when there is a change in pipeline. For triggering emails we need to create SNS topic and add the subscribers to it. But the problem is the mail will trigger to all the guys who are in that topic.
What i want
I want to send an email to the owner and also to the person who triggered the codepipeline(i.e.Developer). Sending the email to the owner process can be done since the owner is one entity. But sending a mail to the person who triggered might be a tricky one. Is there any feature that AWS has for this type of usecase ?
What i did and planning to do
For now, i can able to the get the developer email id by using codecommit API method getcommit which will take commitID as input. So, that means i need to pass the commitID manually to get the email id of the developer. So, in the codepipeline i need to create a lambda function which create a SNS topic and add developer emailID to it and create a cloudevent event rule with this SNS topic and delete as soon as the codepipeline gets complete.
Is there any better approach ?
Any help is appreciated
Thanks
In AWS, I am trying to detect Critical alerts in Guardduty and configure cloudwatch which will trigger mails when there is a critical alert in guardduty.
I found a link http://docs.aws.amazon.com/guardduty/latest/ug/guardduty_findings_cloudwatch.html which uses Lambda to create fuctions which will do that but I was looking for more simpler ways without AWS lamda.
Is there is a way to directly configure a cloudwatch alarm which will keep an eye on Guardduty and can use SNS notifications to send mails to desired team.
I implemented the CloudWatch event as described in the link you posted. I get alerts via SNS. No Lambda required (although you COULD trigger a Lambda function instead of SNS if you wanted).
I have a CloudFormation template which invokes a Lambda function to create a SNS topic. The create-stack works fine and the stack is created and then the topic is created. However, when I try to use update-stack on the same template to update the topic, I see some errors.
I have no idea what this "Internal Failure" is. And the CloudWatch log does not show any error, the Lambda function is also returning response for the "update" request.
I found a guy asking the similar question and the answer is
Important
After you create an Amazon SNS topic, you cannot update its properties
by using AWS CloudFormation. You can modify an Amazon SNS topic by
using the AWS Management Console.
As you know, my CloudFormation template is invoking a Lambda function to create the SNS topic. So, is it possible to call the CloudFormation template to invoke the Lambda function to update the SNS topic? Any help is appreciated.
One more thing: deleting and then creating the SNS topic cannot be considered as a good solution because there are queues subscribing to this topic.
Is it possible to auto send/push the messages in Amazon SQS to DynamoDB? I wish to send my messages to SQS and for period of time I want to send this to DynamoDB. Another service should fetch the DynamoDB table and send it as email using SES.
Kindly help me out to achieve this. I will be using it for the User notification purpose from a Social networking site.
Thanks.
There is no AWS mechanism to automatically publish SQS messages to DynamoDB; but you can use an AWS Lambda event source mapping to automatically pull SQS messages and invoke a Lambda function, and it's pretty straightforward to write a Lambda function that writes those messages to DynamoDB. (Here's an example using Node.js: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/dynamodb-example-table-read-write.html.)
Yes I agree Hyangelo, you can do this with Simple Workflow Service (SWF).
SWF will give you a control feature over your application enabling you to distribute and execute different services or tasks when you want.
Here is the link to the documentation: http://aws.amazon.com/swf/
Sounds like a workflow system from how you describe what you want, have you considered Simple Workflow Service?
SQS can't be processed w/o pulling messages.
You can either use SWF to solve your use-case OR use SNS.
SNS<=>SQS binding is free by AWS.
Send your messages to SNS, bind your SNS with SQS & lambda-function.
On triggering lambda function - you can create dynamodb-record and send it to another SNS2.
Bind SNS2 <=> SES which will trigger the email.
checkout: https://aws.amazon.com/premiumsupport/knowledge-center/lambda-sns-ses-dynamodb/