Skip to content

Instantly share code, notes, and snippets.

function assume-role() {
export $(printf "AWS_ACCESS_KEY_ID=%s AWS_SECRET_ACCESS_KEY=%s AWS_SESSION_TOKEN=%s" \
$(aws sts assume-role \
--role-arn $1 \
--role-session-name $USER \
--query "Credentials.[AccessKeyId,SecretAccessKey,SessionToken]" \
--output text))
}
17:25:48.102
17:25:58.127
17:26:08.163
17:26:18.276
17:26:28.322
17:26:38.434
17:26:48.416
17:26:58.447
17:27:08.496
17:27:18.072
2021-08-06T16:35:14.782
2021-08-06T16:35:24.788
2021-08-06T16:35:34.790
2021-08-06T16:35:44.971
2021-08-06T16:35:54.976
2021-08-06T16:36:04.968
2021-08-06T16:36:14.961
2021-08-06T16:36:24.971
2021-08-06T16:36:34.965
2021-08-06T16:36:45.094
@zaccharles
zaccharles / deprecate-topic.js
Created April 7, 2020 15:57
Deprecate SNS Topic
/*
Problem:
There is an SNS topic that you wish to get rid of so you "deprecate" it.
The idea is to get migrate each subscriber away one by one then eventually
delete the topic.
However, this can be difficult without something stopping new subscribers
from adding new dependencies.
Solution:
This script takes an SNS topic ARN and adds a new statement to its access policy.
@zaccharles
zaccharles / serverless.yml
Created October 4, 2019 12:13
Step Functions Asynchronous Communication - Example 1
service: example1
plugins:
- serverless-step-functions
- serverless-iam-roles-per-function
provider:
name: aws
runtime: nodejs10.x
region: eu-west-1
@zaccharles
zaccharles / OrderCreated.cs
Created February 26, 2019 16:01
OrderCreatedContracts
using System;
using JustEat.OrderHolder.Messages.OrderCreatedContracts;
using JustSaying.Models;
namespace JustEat.OrderHolder.Messages
{
public class OrderCreated : Message
{
public string OrderId { get; set; }
public string Source { get; set; }
@zaccharles
zaccharles / ThirdPartyNotices.txt
Created February 19, 2019 08:33
vsdbg 16.0.11220.2 licenses
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
Microsoft .NET Core Debugger Components incorporates components from the projects listed below. Microsoft licenses these components under the Microsoft .NET Core Debugger Components license terms, except as noted. The original copyright notices and the licenses under which Microsoft received such components are set forth below for informational purposes. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
1. .NET Compiler Platform ("Roslyn") (http://roslyn.codeplex.com/)
2. CoreCLR (https://github.com/dotnet/coreclr)
3. CoreFX (https://github.com/dotnet/corefx)
@zaccharles
zaccharles / launch.json
Last active February 17, 2019 19:39
LambdaRemoteDebug - Example launch.json
{
"version": "0.2.0",
"languageMappings": {
"C#": {
"languageId": "3F5162F8-07C6-11D3-9053-00C04FA302A1",
"extensions": [ "*" ]
}
},
"exceptionCategoryMappings": {
"CLR": "449EC4CC-30D2-4032-9256-EE18EB41B62B",
@zaccharles
zaccharles / Context Object Timeout.csv
Last active January 12, 2019 15:23
AWS Lambda Context Object and Deadline
Language Deadline Timestamp Remaining Time Function
Node.js - getRemainingTimeInMillis()
Python deadline_ms get_remaining_time_in_millis()
Java - getRemainingTimeInMillis()
Go Deadline() -
C# - RemainingTime
PowerShell - RemainingTime
Ruby deadline_ms get_remaining_time_in_millis()
@zaccharles
zaccharles / Handler.cs
Created January 12, 2019 13:54
Files survive when your handler doesn't
public class Handler
{
private Guid _variableGuid;
public Handler()
{
_variableGuid = Guid.NewGuid();
Console.WriteLine($"Constructor: {_variableGuid}");
}