Amazon web services 如何在AWS lambda上连续部署Spring云功能
是否可以将Spring Cloud功能连续部署到AWS Lambda 我想使用gradle和bitbucket管道,或者如果有任何有效的方法可以使用的话Amazon web services 如何在AWS lambda上连续部署Spring云功能,amazon-web-services,spring-boot,aws-lambda,continuous-integration,spring-cloud-function,Amazon Web Services,Spring Boot,Aws Lambda,Continuous Integration,Spring Cloud Function,是否可以将Spring Cloud功能连续部署到AWS Lambda 我想使用gradle和bitbucket管道,或者如果有任何有效的方法可以使用的话 我应该使用'@EnableFunctionDeployer'注释吗?最好的方法是什么?亚马逊提供了一种称为AWS CodePipeline的连续部署工具。 您可以单独使用它来持续部署您的应用程序,也可以将您的功能迁移到AWS Codestar项目,它创建了构建和部署您的功能所需的所有资源。 AWS免费层每月提供一个免费的活动管道,Codesta
我应该使用'@EnableFunctionDeployer'注释吗?最好的方法是什么?亚马逊提供了一种称为AWS CodePipeline的连续部署工具。
您可以单独使用它来持续部署您的应用程序,也可以将您的功能迁移到AWS Codestar项目,它创建了构建和部署您的功能所需的所有资源。
AWS免费层每月提供一个免费的活动管道,Codestar是免费的,因此您可以在不产生任何费用的情况下查看它。
@EnableFunctionDeployer
不会执行您正在寻找的任务`
如果Spring启动应用程序需要,则在其上使用注释
部署包含函数定义的jar文件
下面是如何使用此注释的示例
@SpringBootApplication
@EnableFunctionDeployer
public class FunctionApplication {
public static void main(String[] args) throws IOException {
new ApplicationBootstrap().run(FunctionApplication.class, args);
}
}
有关EnableFunctionDeployer的更多信息
虽然,我似乎找不到一个可以直接部署到AWS Lambda的
gradle
插件,但是使用maven
和许多插件和方法很容易实现
一个例子——AWS文章有一个maven原型,它生成一个代码库,用于直接部署到AWS Lambda(在后台使用CloudFormation)。下面是用于执行aws cloudformation
可执行文件的插件配置
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>sam-local-invoke</id>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>sam</executable>
<arguments>
<argument>local</argument>
<argument>invoke</argument>
<argument>-e</argument>
<argument>event.json</argument>
</arguments>
<skip>${skipLocalInvoke}</skip>
</configuration>
</execution>
<execution>
<id>sam-package</id>
<phase>install</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>aws</executable>
<arguments>
<argument>cloudformation</argument>
<argument>package</argument>
<argument>--region=${awsRegion}</argument>
<argument>--template-file=template.yaml</argument>
<argument>--output-template-file=target/sam.yaml</argument>
<argument>--s3-bucket=${s3Bucket}</argument>
<argument>--s3-prefix=${s3Prefix}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>sam-deploy</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>aws</executable>
<arguments>
<argument>cloudformation</argument>
<argument>deploy</argument>
<argument>--region=${awsRegion}</argument>
<argument>--template-file=target/sam.yaml</argument>
<argument>--stack-name=${stackName}</argument>
<argument>--capabilities=CAPABILITY_IAM</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
org.codehaus.mojo
(不过需要测试一下)
我个人的观点是使用gradle/maven构建jar,并使用框架进行部署,使用不同的工具将部署和构建分离开来
示例-
让我知道你的想法。我也需要@EnableFunctionDeployer,但我看不到任何示例如何实现它,你知道有什么示例吗?我无法给出完整的示例,但这是使用@EnableFunctionDeployer的示例。我对答案进行了编辑,以供将来的用户参考。如果您同意,请接受它作为答案。我无法想象如何将它与aws lambda一起使用,我需要为function.location指定哪个jar?是同一功能项目的其他版本吗?我需要将jar上传到s3 bucket吗?检查问题。它提供了一些关于如何使用deployer的线索。