Skip to content

Instantly share code, notes, and snippets.

@sisyphushappy
sisyphushappy / index.py
Created May 24, 2022 04:14
Python lambda handler (update_github_remote_tag_file_handler) to update a tag file in a remote GitHub repository with a value
import base64
import boto3
from botocore.exceptions import ClientError
from git import Actor, Repo
import json
import os
def handler(event, context):
print('request: {}'.format(json.dumps(event)))
@sisyphushappy
sisyphushappy / docker-stack.ts
Created May 24, 2022 04:11
Build a docker image asset, deploy it to ECR, and update a file in a remote GitHub repo with the docker image asset hash
import {Duration, Stack, StackProps} from "aws-cdk-lib";
import {Construct} from "constructs";
import {Repository} from "aws-cdk-lib/aws-ecr";
import {Function, LayerVersion, Runtime} from "aws-cdk-lib/aws-lambda";
import {ArnPrincipal, Effect, ManagedPolicy, PolicyStatement} from "aws-cdk-lib/aws-iam";
import {PythonFunction} from "@aws-cdk/aws-lambda-python-alpha";
import {DockerImageAsset} from "aws-cdk-lib/aws-ecr-assets";
import * as path from "path";
import * as ecrdeploy from 'cdk-ecr-deployment';
import {Secret} from "aws-cdk-lib/aws-secretsmanager";