[英]AWS Cron jobs with lambdas
I want to set up cron jobs for my application using lambda functions.我想使用 lambda 函数为我的应用程序设置 cron 作业。 My current architecture consists of an auto-scaling group behind a load balancer, both inside the same VPC.
我当前的架构由负载均衡器后面的自动缩放组组成,两者都在同一个 VPC 内。 My intention is to call a specific path to my application, for instance "/cron/task1" using lambdas, and call them at regular intervals using the cron-like syntax.
我的意图是调用我的应用程序的特定路径,例如使用 lambdas 的“/cron/task1”,并使用类似 cron 的语法定期调用它们。 How can I secure my application so that such endpoints can only be reached from lambda functions and not from outside the vpc, while allowing reachability to all other paths of the application from the final users?
如何保护我的应用程序,以便只能从 lambda 函数而不是从 vpc 外部访问此类端点,同时允许最终用户访问应用程序的所有其他路径?
Api authorization may be what you need. Api 授权可能是您需要的。 One of the easiest way(not most secure) to do is;
最简单的方法之一(不是最安全的)是;
myapp.url/cron/task1?a=value&c=something&b=foobar myapp.url/cron/task1?a=value&c=something&b=foobar
You sort parameters in ascending/descending order您按升序/降序对参数进行排序
{
"a": "val",
"b": "foobar"
"c": "some",
}
cf23df2207d99a74fbe169e3eba035e633b65d94
cf23df2207d99a74fbe169e3eba035e633b65d94
now your request will be现在您的请求将是
myapp.url/cron/task1?a=val&c=some&b=foobar&token=cf23df2207d99a74fbe169e3eba035e633b65d94 myapp.url/cron/task1?a=val&c=some&b=foobar&token=cf23df2207d99a74fbe169e3eba035e633b65d94
You may keep that secrets in aws kms to not expose and make it more secure.您可以将这些秘密保存在aws kms中,以免暴露并使其更安全。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.