Skip to content

Instantly share code, notes, and snippets.

@rockpenguin
rockpenguin / Slack_Notification_README.md
Last active June 14, 2022 13:34
Generating Slack Notifications From Pub/Sub Log Data

Overview

This was tested on a GCP Cloud Function using Python runtime 3.9. Make sure to also update the requirements.txt (attached) as part of your Cloud Function

  • There are several print() statements in the attached Python code for debugging purposes. These can be removed.
  • The Slack URL should be fed in via environment variable or secret since the URL contains secrets. From the Slack docs "Keep it secret, keep it safe. Your webhook URL contains a secret. Don't share it online, including via public version control repositories. Slack actively searches out and revokes leaked secrets."
  • Here are the docs concerning Slack Block-Kit blocks for formatting the message

Testing procedure

  1. In the GCP console, navigate to Pub/Sub and select "Topic" on the left-hand menu
@rockpenguin
rockpenguin / aws_budget_actions_iam.md
Last active May 4, 2022 18:24
AWS Budget Action Roles And Policies

Budget Action Execution Role Policy Examples

To create a role that will be used by the Budget Action to perform actions

  1. Use one of the below example policies to restrict access to what the role can do
  2. Attach the example Trust policy below to restrict the role to only your Budget Actions (i.e. someone else can't use the role for Lambdas or another AWS service)

An example IAM policy that only allows Budget Actions to access IAM

{
  "Version": "2012-10-17",
@rockpenguin
rockpenguin / cloud_sql_shared_vpc.md
Last active April 29, 2022 14:14
GCP Cloud SQL Private IP Shared VPC

Screen Shot 2022-04-28 at 4.34.14 PM.pngimage

Screen Shot 2022-04-29 at 9.02.25 AM.pngimage

Screen Shot 2022-04-29 at 10.13.21 AM.pngimage

Screen Shot 2022-04-29 at 9.35.21 AM.pngimage

@rockpenguin
rockpenguin / features.py
Created June 11, 2017 16:27
Libcloud 'features'
from pprint import pprint
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
import texttable
# exception handling
from libcloud.common.exceptions import *

Keybase proof

I hereby claim:

  • I am rockpenguin on github.
  • I am rockpenguin (https://keybase.io/rockpenguin) on keybase.
  • I have a public key ASDy4rd6lFeXDeXvS1CW3pVZCo3xE3N2rmqS5ialw1XcHgo

To claim this, I am signing this object: