Skip to content

Instantly share code, notes, and snippets.

@koheyamada
koheyamada / maintenance
Created December 20, 2018 06:39
nginxでメンテナンスページを表示させる。改良版 ref: https://qiita.com/kooohei/items/095eb1304f9fa67ed1a1
error_page 500 @maintenance;
# Set Env
set $maintenance "on";
# Allow Paths
if ($uri ~ "^/exclude/") {
set $maintenance "off";
}
@koheyamada
koheyamada / IAMポリシー
Last active October 19, 2018 08:09
スイッチロールユーザーに対して期間限定&MFA利用でのアクセスを許可する。 ref: https://qiita.com/kooohei/items/dc214263ca4af90f9991
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": [
"*"
],
"Resource": "*",
"Condition": {
"DateGreaterThan": {"aws:CurrentTime": "2018-10-01T00:00:00Z"},
@koheyamada
koheyamada / maintenance
Created October 18, 2018 12:28
nginxでメンテナンスページを表示させる。 ref: https://qiita.com/kooohei/items/b0deaf39124e7a47546a
set $maintenance "true";
if ($uri ~ "^/maintenance.html") {
set $maintenance "false";
}
if ($uri ~ "^/exclude/") {
set $maintenance "false";
}
if ($remote_addr ~ "xxx.xxx.xxx.xxx") {
set $maintenance "false";
$ sudo mkdir /opt/chroot
$ sudo chown root.root /opt/chroot
$ sudo mkdir /opt/sftpuser
$ sudo chown sftpuser /opt/sftpuser/data
$ sudo chmod 755 /opt/sftpuser/data
@koheyamada
koheyamada / sendmail
Created September 21, 2018 03:05
sendmail 再送関連についてまとめ ref: https://qiita.com/kooohei/items/f4a699e040bfc1dc058b
QUEUE=1h
@koheyamada
koheyamada / addIpToNic
Created July 13, 2018 04:13
IDCFクラウドでVyOSの冗長化を行う。 ref: https://qiita.com/kooohei/items/74e87ac66f242d49f96d
$ cloudstack-api addIpToNic --nicid <Masterで利用しているNIC ID> --ipaddress <VIP>
{
"addiptovmnicresponse": {
"id": "********-****-****-****-************",
"jobid": "********-****-****-****-************"
}
}
@koheyamada
koheyamada / marathon.csv
Created May 2, 2018 13:21
Amazon S3 Select を使ってS3オブジェクトの特定データを抽出する。 ref: https://qiita.com/kooohei/items/bc180302cc98c01074d4
marathon type m region
honolulu full 12 hawaii
shonann full 12 kanagawa
okayama full 11 okayama
fukkou full 10 miyagi
fuji5lake ultra 4 yamanashi
yokohama full 10 kanagawa
@koheyamada
koheyamada / Policy変更
Created April 28, 2018 03:12
aws-cli で ClassicLoadBalancer の TLS を変更する。 ref: https://qiita.com/kooohei/items/6b64cce748b8d7380da1
$ aws elb set-load-balancer-policies-of-listener --load-balancer-name <CLBの名前> --load-balancer-port 443 --policy-names <セキュリティポリシーの名前>
@koheyamada
koheyamada / CloudMapperの取得
Last active November 27, 2018 19:37
CloudMapperを使ってAWS環境を可視化する。 ref: https://qiita.com/kooohei/items/58b6d8654a89c911a2e9
$ git clone git@github.com:duo-labs/cloudmapper.git
@koheyamada
koheyamada / アクセス確認
Created April 27, 2018 05:59
VPCエンドポイントを使ってプライベートサブネットからS3へアクセスする。 ref: https://qiita.com/kooohei/items/794a7d6e041f43f98f5b
$ aws s3 ls s3://koh3i/
2018-03-17 06:46:22 5330 SampleApp_Linux.zip