Skip to content

Instantly share code, notes, and snippets.

@alsmola
alsmola / cloudtrail_partition_create_athena_table.sql
Last active August 23, 2023 10:28
cloudtrail_partition_create_athena_table
CREATE EXTERNAL TABLE cloudtrail_logs (
eventversion STRING,
userIdentity STRUCT<
  type:STRING,
  principalid:STRING,
  arn:STRING,
  accountid:STRING,
  invokedby:STRING,
  accesskeyid:STRING,
userName:STRING,
@alsmola
alsmola / policy.yml
Last active May 8, 2022 22:22
Permissions for IAM deploy role
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"signer:GetSigningProfile",
"signer:PutSigningProfile"
]
"Resource": "arn:aws:signer:us-east-1:[account-number]:/signing-profiles/[signing-profile-name]"
@alsmola
alsmola / serverless.yml
Last active May 8, 2022 18:11
Serverless configuration for a SigningProfile and CodeSigningConfig
Resources:
SigningProfile:
Type: AWS::Signer::SigningProfile
Properties:
PlatformId: AWSLambda-SHA384-ECDSA
CodesignedFunctionConfig:
Type: AWS::Lambda::CodeSigningConfig
Properties:
Description: "GitHub Action Code Signing for Lambdas"
AllowedPublishers:
@alsmola
alsmola / deploy.yml
Created May 8, 2022 18:03
GitHub Action configuration to deploy to AWS via OIDC and Serverless
name: Deploy main to production
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
@alsmola
alsmola / cloudtrail_partitions.js
Last active November 23, 2021 08:51
cloudtrail_partitions
'use strict';
console.log('Loading function');
const aws = require('aws-sdk');
aws.config.update({region: 'us-east-1'});
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
const ddb = new aws.DynamoDB({apiVersion: '2012-10-08'});
const athena = new aws.Athena();
# CircleCI configuration to publish markdown files to Confluence
version: 2
jobs:
build:
branches:
only:
- master
docker:
- image: circleci/golang:1.13.11
@alsmola
alsmola / main.go
Last active March 26, 2021 02:04
Template for Lambda events handler for Serverless Slack Block Kit application
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"github.com/aws/aws-lambda-go/events"
@alsmola
alsmola / main.go
Last active March 26, 2021 02:03
Template for Lambda interactions handler for Serverless Slack Block Kit application
package main
import (
"context"
"encoding/json"
"fmt"
"net/url"
"strings"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
@alsmola
alsmola / main.go
Last active March 26, 2021 02:03
Template for Lambda external select menu handler for Serverless Slack Block Kit application
package main
import (
"context"
"encoding/json"
"fmt"
"strings"
"github.com/slack-go/slack"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
@alsmola
alsmola / main.go
Created March 6, 2021 22:25
Template for Lambda auth callback handler for Serverless Slack Block Kit application
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"