Skip to content

Instantly share code, notes, and snippets.

@Twinuma
Twinuma / vpc-bestpractice-develop.template
Last active March 30, 2016 01:55
vpc bestpractice template for development
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "VPC Bestpractice Template For MonstarLab,Inc.",
"Parameters": {
"SSHLocation" : {
"Description" : " The IP address range that can be used to SSH to the EC2 instances",
"Type": "String",
"MinLength": "9",
"MaxLength": "18",
"Default": "0.0.0.0/0",
@Twinuma
Twinuma / vpc_template.json
Created October 8, 2015 08:43
オレオレVPC構築テンプレート
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpc80ef6be5": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "false",
@Twinuma
Twinuma / awspec.log
Created September 24, 2015 11:52
"awspec init"実行ログ
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require': /Library/Ruby/Gems/2)
... def has_listener?(protocol:, port:, instance_protocol:, i...
... ^
/Library/Ruby/Gems/2.0.0/gems/awspec-0.14.0/lib/awspec/type/elb.rb:60: syntax error, unexpected keyword_end, expecting end-of-input
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
from /Library/Ruby/Gems/2.0.0/gems/awspec-0.14.0/lib/awspec/helper/type.rb:12:in `block in <module:Type>'
from /Library/Ruby/Gems/2.0.0/gems/awspec-0.14.0/lib/awspec/helper/type.rb:11:in `each'
from /Library/Ruby/Gems/2.0.0/gems/awspec-0.14.0/lib/awspec/helper/type.rb:11:in `<module:Type>'
from /Library/Ruby/Gems/2.0.0/gems/awspec-0.14.0/lib/awspec/helper/type.rb:3:in `<module:Helper>'
from /Library/Ruby/Gems/2.0.0/gems/awspec-0.14.0/lib/awspec/helper/type.rb:2:in `<module:Awspec>'
@Twinuma
Twinuma / ddos_bestpractice_vpc_template.json
Last active September 1, 2015 07:19
DDoSに対するAWSのベストプラクティスを構築するテンプレート
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpce17ecf84": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "false",
@Twinuma
Twinuma / environment-cloudformer.json
Last active August 29, 2015 14:25
CloudFormationを使って開発・ステージング・本番環境を自動構築する
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpcf84de09d": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true",
@Twinuma
Twinuma / vpc_publicsubnetx2_privatesubnetx2_cloudformation.json
Created July 15, 2015 17:37
Tokyoリージョン内にMulti-AZでPublic SubnetとPrivate Subnetをそれぞれ2つずつ配置されたVPCを、CloudFormationで自動構成
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"vpc84b012e1": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "false",
@Twinuma
Twinuma / create_ami.sh
Created June 6, 2015 07:46
AMIのバックアップの取得
#!/bin/sh
DATE_CURRENT=`date +%Y-%m-%d`
TIME_CURRENT=`date +%Y%m%d%H%M%S`
PURGE_AFTER_DAYS=10
PURGE_AFTER=`date -d +${PURGE_AFTER_DAYS}days -u +%Y-%m-%d`
# 1-1.バックアップを作成したいリソース一覧を取得する
INSTANCES=`aws ec2 describe-tags --filters "Name=resource-type,Values=instance" "Name=key,Values=Backup" | awk '{print $3}'`
for INSTANCE in ${INSTANCES}; do
@Twinuma
Twinuma / commmand
Last active August 29, 2015 14:21
Homebrew勉強会スライド内のコマンド
## xcodeインストール
xcode-select --install
## Homebrew install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
## brew doctor
brew doctor
## brew update
@Twinuma
Twinuma / playbook.yml
Created February 17, 2015 05:55
ドットインストールで作成したAnsibleのplaybook.yml
---
- hosts: all
sudo: yes
tasks:
- name: add a new user
user: name=takayuki
- name: insdtall libselinux-python
yum: name=libselinux-python state=latest
- hosts: web
@Twinuma
Twinuma / ec2control.sh
Created December 28, 2014 03:22
EC2の自動起動・停止用シェルスクリプト
#!/bin/sh
DEFAULT_REGION='ap-northeast-1'
INSTANCE_ID='i-xxxxxxxx'
echo ""
echo "instance-id:["$INSTANCE_ID"]"
## 指定インスタンスのステータス確認(aws ec2 describe-instance-status)
INSTANCE_STATUS=`aws ec2 describe-instance-status --instance-ids $INSTANCE_ID --region $DEFAULT_REGION | jq -r '.InstanceStatuses[].InstanceState.Name'`
echo "instance-status:["$INSTANCE_STATUS"]"