Skip to content

Instantly share code, notes, and snippets.

View iam-policy-diff.rb
#!/usr/bin/env ruby
require 'json'
def read_json(file_name)
JSON.parse(File.read(file_name))
end
def parse(iam)
result = []
@fujiwara
fujiwara / gist:c33927f5b03007c0fdeedd171488e5e5
Last active May 14, 2021
ecspresso handbook diff between v1.3 and v1.5.4
View gist:c33927f5b03007c0fdeedd171488e5e5
diff --git a/books/ecspresso-handbook/codedeploy.md b/books/ecspresso-handbook/codedeploy.md
index 7204de5..e68c4ea 100644
--- a/books/ecspresso-handbook/codedeploy.md
+++ b/books/ecspresso-handbook/codedeploy.md
@@ -185,9 +185,9 @@ https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/userguide/deployment-type-blu
Blue/Green デプロイを設定したサービスは、オートスケーリングが有効な状態ではデプロイが行えません。
-`ecspresso deploy --suspend-autoscaling` を指定することで、デプロイ前に Application Autoscaling を一時的に停止できます。
+`ecspresso deploy --suspend-auto-scaling` を指定することで、デプロイ前に Application Autoscaling を一時的に停止できます。
View gist:9785a528bfbfedd8a746c015dfc49a99
aws ecs describe-task-definition --task-definition ecspresso-test --include TAGS | jq '. | {containerDefinitions:.taskDefinition.containerDefinitions, cpu:.taskDefinition.cpu, executionRoleArn:.taskDefinition.executionRoleArn, family:.taskDefinition.family, memory:.taskDefinition.memory, networkMode:.taskDefinition.networkMode, placementConstraints:.taskDefinition.placementConstraints, requiresCompatibilities:.taskDefinition.requiresCompatibilities, taskRoleArn:.taskDefinition.taskRoleArn, proxyConfiguration:.taskDefinition.proxyConfiguration, volumes:.taskDefinition.volumes, tags:.tags}'
@fujiwara
fujiwara / config.yml
Created Feb 21, 2020
aws-cli-v2 orb
View config.yml
orbs:
aws-cli-v2:
commands:
install:
steps:
- run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
@fujiwara
fujiwara / fluentd.conf
Last active Feb 7, 2020
fix fluentd tags from firelens
View fluentd.conf
<match *-firelens-*>
@type firelens_tag_filter
</match>
<match app.firelens.**>
# ...
</match>
@fujiwara
fujiwara / graph-depends-on.pl
Created May 29, 2019
Visualize container dependencies from ECS task definition JSON.
View graph-depends-on.pl
#!/usr/bin/env perl
use 5.12.1;
use warnings;
use JSON::PP;
my $file = shift;
open my $in, "<", $file or die $!;
my $taskdef = JSON::PP::decode_json(do { local $/ = undef; <$in> });
my $g = $file;
View slack_reporter.pl
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use 5.014;
use Encode;
use JSON::PP qw/encode_json decode_json/;
use Sys::Hostname;
use IPC::Open2;
@fujiwara
fujiwara / index.js
Created Feb 22, 2019
Lambda Edge redirector
View index.js
exports.handler = async (event, context, callback) => {
const response = {
status: "302",
statusDescription: "Found",
headers: {
location: [{
key: 'Location',
value: 'http://contents.xj-storage.jp/xcontents/AS01527/ec0b38f1/7c8b/4dbc/89e1/106de9ea3108/20190108140352250s.pdf',
}],
}
@fujiwara
fujiwara / main.go
Created Feb 18, 2019
cloudwatch-to-mackerel
View main.go
package main
import (
"context"
"encoding/json"
"errors"
"log"
"os"
"time"
@fujiwara
fujiwara / main.go
Created Feb 15, 2019
Convert GetMetricData results to Mackerel metric format.
View main.go
package main
import (
"encoding/json"
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"