Skip to content

Commit

Permalink
add sg
Browse files Browse the repository at this point in the history
  • Loading branch information
sorah committed Jun 25, 2015
1 parent 2a5c6a9 commit cb63064
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
14 changes: 14 additions & 0 deletions config/deploy/sg.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
run_piculet = proc do |*args|
region = ENV['REGION'] || ENV['AWS_REGION'] || ENV['AWS_DEFAULT_REGION'] || 'ap-northeast-1'
cmd = [*%w(piculet -a -f), "sg/#{region}/Groupfile", '-r', region, *args]
p cmd
exec *cmd
end

task :apply do
run_piculet[]
end

task :noop do
run_piculet['--dry-run']
end
107 changes: 107 additions & 0 deletions sg/ap-northeast-1/Groupfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

### kosendj-main
ec2 "vpc-f43d9b91" do
security_group "default" do
description "default VPC security group"

ingress do
permission :any do
groups(
"default"
)
end

permission :tcp, 22..22 do
ip_ranges(
"125.30.60.164/32",
)
end

permission :tcp, 22982..22982 do
ip_ranges(
"0.0.0.0/0",
)
end
end

egress do
permission :any do
ip_ranges(
"0.0.0.0/0"
)
end
end
end

security_group "http-public" do
description "open"

ingress do
permission :tcp, 80..80 do
ip_ranges(
"0.0.0.0/0",
)
end

permission :tcp, 443..443 do
ip_ranges(
"0.0.0.0/0",
)
end
end

egress do
permission :any do
ip_ranges(
"0.0.0.0/0"
)
end
end
end

security_group "mysql" do
description "open"

ingress do
permission :tcp, 3306..3306 do
groups(
"default",
)
end
end

egress do
permission :any do
ip_ranges(
"0.0.0.0/0"
)
end
end
end
end


### Default VPC
ec2 "vpc-df48eeba" do
security_group "default" do
description "default VPC security group"

ingress do
permission :any do
groups(
"default"
)
end
end

egress do
permission :any do
ip_ranges(
"0.0.0.0/0"
)
end
end
end
end

0 comments on commit cb63064

Please sign in to comment.