diff --git a/roles/openresty/files/java-nginx-config/nginx/conf/lua/init_lua.lua b/roles/openresty/files/java-nginx-config/nginx/conf/lua/init_lua.lua
index d6bfe67..cb16dc3 100644
--- a/roles/openresty/files/java-nginx-config/nginx/conf/lua/init_lua.lua
+++ b/roles/openresty/files/java-nginx-config/nginx/conf/lua/init_lua.lua
@@ -1,4 +1,5 @@
 local lrucache = require "resty.lrucache"
+local switch_controller = require "switch_controller"
 
 -- init redis twemproxy config
 
@@ -20,6 +21,8 @@ lua_context.lua_conf_cache=ngx.shared.ngxconf
 
 lua_context.configs={}
 
+--- init switch to aws percentage
+switch_controller.init()
 
 ngx.shared.upstream:flush_all()
 ngx.shared.upstream:flush_expired()
diff --git a/roles/openresty/files/java-nginx-config/nginx/conf/lua/switch_controller.lua b/roles/openresty/files/java-nginx-config/nginx/conf/lua/switch_controller.lua
new file mode 100644
index 0000000..15cc40f
--- /dev/null
+++ b/roles/openresty/files/java-nginx-config/nginx/conf/lua/switch_controller.lua
@@ -0,0 +1,41 @@
+local modname= ...
+local M={}
+_G[modname]=M
+package.loaded[modname]=M
+
+
+ 
+ 
+
+-- switch.
+-- switch_to_aws:  http://erp.yoho.yohoops.org/switch/?method=switch&percentage=10
+-- switch query:    http://erp.yoho.yohoops.org/switch/?method=query
+
+-- mal ip controller api --------
+function M:switch()
+   local method=http_request.get_req_param("method")
+
+   if method == "query" then
+       local percentage = lua_context.lua_conf_cache:get("switch:percentage")
+       ngx.say(percentage)
+       ngx.exit(ngx.HTTP_OK)
+  
+   end
+
+   if method == "switch" then
+      local  percentage = http_request.get_req_param("percentage")
+      if percentage then
+       lua_context.lua_conf_cache:set("switch:percentage", percentage)
+       ngx.exit(ngx.HTTP_OK)
+      end
+   end
+end 
+
+function M:init()
+   return lua_context.lua_conf_cache:set("switch:percentage", 0)
+ end
+
+ 
+function M:get_percentage()
+  return lua_context.lua_conf_cache:get("switch:percentage")
+end
diff --git a/roles/openresty/files/java-nginx-config/nginx/conf/vhosts/erp.yoho.yohoops.org.conf b/roles/openresty/files/java-nginx-config/nginx/conf/vhosts/erp.yoho.yohoops.org.conf
index 15dc63f..58ad32f 100644
--- a/roles/openresty/files/java-nginx-config/nginx/conf/vhosts/erp.yoho.yohoops.org.conf
+++ b/roles/openresty/files/java-nginx-config/nginx/conf/vhosts/erp.yoho.yohoops.org.conf
@@ -36,6 +36,14 @@ server {
  		';
  	}
 
+   ## switch management
+    location = /switch {
+ 	    content_by_lua '
+ 		  local switch = require "switch_controller";
+           switch:switch();
+ 		';
+ 	}
+
     location = /upstreams {
        content_by_lua_file  "conf/lua/upstream.lua";
     }
diff --git a/roles/openresty/templates/nginx.conf.j2 b/roles/openresty/templates/nginx.conf.j2
index 59d8443..c853fec 100644
--- a/roles/openresty/templates/nginx.conf.j2
+++ b/roles/openresty/templates/nginx.conf.j2
@@ -176,6 +176,12 @@ http
       #apigatewayend
  
  
+      # upstream for yoho-core-java aws
+      upstream java-aws {
+         server java-gateway-431f16063270008f.elb.cn-north-1.amazonaws.com.cn:8080 max_fails=5  fail_timeout=3s;   
+         keepalive	32;
+      }
+      #apigatewayend
 
 
     # activity