Skip to content

Commit c8a9f8e

Browse files
Merge pull request hashicorp#18 from hashicorp/updateAWSLambdaReadme
Updated readme.
2 parents 504181d + 4447d16 commit c8a9f8e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

infrastructure-as-code/aws-lambda-ec2-lifecycles/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,30 @@ You can optionally encrypt the Slack Webhook URL so that it cannot be viewed in
215215
9. Navigate back to the AWS Lambda functions and repeat steps #1-8 for any other functions where you want to configure the encrypted URL.
216216
10. If you want to make this configuration permanent, comment out the `aws_kms_key` and `aws_kms_alias` resources in encryption.tf. Then use the `terraform state rm` command to remove both of them from your state file. The key you created will now be persistent, and allow you to save your encrypted Slack Webhook URL in your variables file. You can fetch the encrypted URL by running `terraform show` command.
217217

218+
### Optional - Edit the Slack message and formatting
219+
If you'd like to customize the messages that get sent into your Slack channels, just edit the part of the code that calls the `send_slack_message` function. Note how you can put action buttons into your message to link your users to useful information or status pages. The Slack API guide has examples and more info: https://api.slack.com/docs/message-formatting
220+
221+
```
222+
send_slack_message(
223+
msg_text,
224+
title='AWS Instance Type Usage',
225+
text="```\n"+report+"\n```",
226+
fallback='AWS Instance Type Usage',
227+
color='warning',
228+
actions = [
229+
{
230+
"type": "button",
231+
"text": ":money-burning: AWS Cost Explorer",
232+
"url": "http://amzn.to/2EBAfQu"
233+
},
234+
{
235+
"type": "button",
236+
"text": ":broom: AWS Console",
237+
"url": "https://console.aws.amazon.com/ec2/v2/home"
238+
},
239+
]
240+
)
241+
```
242+
218243
### Clean up
219244
Cleanup is simple, just run `terraform destroy` in your workspace and all resources will be cleaned up.

infrastructure-as-code/aws-lambda-ec2-lifecycles/untagged_janitor.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ resource "aws_lambda_function" "cleanUntaggedInstances" {
88
source_code_hash = "${base64sha256(file("./files/cleanUntaggedInstances.zip"))}"
99
runtime = "python3.6"
1010
timeout = "120"
11-
description = "Checks instance TTLs for expiration and deals with them accordingly."
11+
description = "Stops or terminates untagged instances after a pre-set number of days."
1212
environment {
1313
variables = {
1414
slackChannel = "${var.slack_channel}"

0 commit comments

Comments
 (0)