Skip to content

Instantly share code, notes, and snippets.

View embano1's full-sized avatar

Michael Gasch embano1

View GitHub Profile
embano1 /
Last active June 23, 2023 14:49
EventBridge CloudEvents Input Transformer


Transform EventBridge Events to CloudEvents using Input Transformer, incl. projecting AWS Region and Account ID from the EventBridge event to CloudEvent extended attributes.

You can test whether the transformed CloudEvent is valid using this simple CloudEvent validator utility.

Example Event

embano1 / README.MD
Last active February 6, 2023 16:29
Global Endpoints IAM Example

Trust Relationship

Assume a role named EventBridgeGlobalEndpoints which is important for the "iam:PassRole" part.

    "Version": "2012-10-17",
    "Statement": [
            "Effect": "Allow",
embano1 / handler.ts
Created October 3, 2022 11:31
CloudEvents TypeScript AWS Lambda SQS Example
import {SQSEvent, SQSHandler} from 'aws-lambda';
import {CloudEvent} from 'cloudevents';
export const handler: SQSHandler = async (events: SQSEvent) => {
events.Records.forEach(e => {
const ce: CloudEvent<string> = new CloudEvent<string>(JSON.parse(e.body));
embano1 /
Created September 23, 2022 09:29
Build and run AWS Lambda Containers locally with Go and ko on M1 Mac

download Lambda RUI for M1

mkdir -p ~/.aws-lambda-rie && curl -Lo ~/.aws-lambda-rie/aws-lambda-rie \ \
&& chmod +x ~/.aws-lambda-rie/aws-lambda-rie


embano1 /
Created April 6, 2022 08:58
Retrieve StorageIOAllocation property of a virtual disk
$ ./govc object.collect -json /vcqaDC/vm/vm-with-disk config.hardware.device \
  | jq '.[0].Val.VirtualDevice[]|select(.Key==2000)|.StorageIOAllocation'
  "Limit": -1,
  "Shares": {
    "Shares": 1000,
    "Level": "normal"
 "Reservation": 0
embano1 /
Last active April 22, 2022 09:01
go 1.18 assert.Equal benchmark
go test -v -bench=. -gcflags '-l -N' -cpu=1,2,4 -benchmem
goos: darwin
goarch: amd64
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
BenchmarkEqualGeneric           462083778                2.392 ns/op           0 B/op          0 allocs/op
BenchmarkEqualGeneric-2         504194739                2.391 ns/op           0 B/op          0 allocs/op
BenchmarkEqualGeneric-4 513227227 2.470 ns/op 0 B/op 0 allocs/op
embano1 / workflow.yaml
Created March 11, 2022 12:15
Github Actions ko cosign Example
name: image
branches: ['main']
contents: read
packages: write
embano1 /
Last active September 9, 2021 08:34
HTTP CloudEvents function always returning 500 (for failure tests, retries, etc.)
export KIND_CLUSTER_NAME=knative-0.24
export KO_DOCKER_REPO=kind.local
ko apply -f .
embano1 /
Created July 26, 2021 20:47
VMware Horizon Events API


Note: Access token is valid for 8min.

TOKEN=$(echo -n '{"domain":"corp","username":"administrator","password":"VMware1!"}'| curl -s -d@- -H "content-type: application/json" -k | jq -r '.access_token')

Filter to URL-encoded

embano1 /
Last active November 23, 2021 09:30
End-to-End Installation of VMware Event Router with kind

End-to-End Installation of VMware Event Router with kind

The following steps describe the installation of the VMware Event Router (also part of the VEBA project) in a local Kubernetes and Knative environment.

The steps assume a Mac OSX environment but the links provide resources to install the components for other platforms.