小编mat*_*sev的帖子

CloudFormation - 从 Lambda 代码访问参数

我有一个CloudFormation如下所示的模板:

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "This template will deploy stuff",
    "Parameters":{
    "myParamToLambdaFunction" : {
        "Description" : "Please enter the the value",
        "Type" : "String",
        "ConstraintDescription" : "must have some value."
    }
},
"Resources": {
    "SecGrpValidatorFromCFTemplate": {
        "Type": "AWS::Lambda::Function",
        "Properties": {
            "FunctionName": "mylambdafunctionname",
            "Handler": "myfile.lambda_handler",
            "Role": {
                "Fn::GetAtt": ["somerole", "Arn"]
            },
            "Timeout": "30",
            "Runtime": "python2.7",
            "Code": {
                "S3Bucket":"mybucket",
                "S3Key":"mylambdafunction.zip"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要将 的值传递myParamToLambdaFunction给 Lambda 函数。

有办法这样做吗?

amazon-web-services aws-cloudformation aws-lambda

5
推荐指数
1
解决办法
7223
查看次数

如何使用API​​网关调用AWS步骤功能?

根据亚马逊的文档,可以使用HTTP API调用步骤函数.

步骤函数可以通过步骤函数控制台,AWS开发工具包或HTTP API进行访问和使用.

我试图搜索详细信息,但似乎找不到任何好的信息.有没有人知道如何使用API​​网关调用AWS步骤功能,类似于调用Lambda函数的方式?

amazon-web-services aws-lambda aws-api-gateway aws-step-functions

5
推荐指数
1
解决办法
4794
查看次数

覆盖 jest-junit 默认输出位置?

如何覆盖默认输出目录和文件名jest-junit

我想在使用Jest时自定义输出的输出配置,但它仍然在默认位置,即./junit.xml在项目根文件夹中。


我的配置

package.json 中

  "scripts": {
    "test": "jest --ci --reporters=default --reporters=jest-junit"
  },
  "devDependencies": {
    "jest": "^24.9.0",
    "jest-junit": "^10.0.0",
  }
Run Code Online (Sandbox Code Playgroud)

jest.config.js 中

module.exports = {
  testMatch: [
    '**/*.spec.js',
  ],
  reporters: [
    'default',
    [ 'jest-junit', {
      outputDirectory: 'test_reports',
      outputName: 'jest-junit.xml',
    } ]
  ]
};
Run Code Online (Sandbox Code Playgroud)

预期结果:

  • 包含测试结果的文件 ./test_reports/jest-junit.xml

实际结果:

  • 默认为测试结果的文件 ./junit.xml

javascript xunit jestjs jest-junit

5
推荐指数
1
解决办法
2518
查看次数

4
推荐指数
1
解决办法
3776
查看次数

Gradle processResources - 文件包含$ character

如何gradle processResources$不转义文件的情况下对包含字符$的文件执行?


我有一些静态html文件位于Spring Boot参考文档/resources/static建议的文件夹中.但是,当我尝试执行时,Gradle会抛出异常gradle processResources

Caused by: org.gradle.api.GradleException: 
Could not copy file '[...]/src/main/resources/static/dollar.html' 
to '[...]/build/resources/main/static/dollar.html'.
[...]
Caused by: groovy.lang.GroovyRuntimeException: 
Failed to parse template script (your template may contain an error 
or be trying to use expressions not currently supported): startup failed:
SimpleTemplateScript7.groovy: 1: illegal string body character after dollar sign;
solution: either escape a literal dollar sign "\$5" 
or bracket the value expression "${5}" @ line 1, column 10.
out.print("""<!DOCTYPE …
Run Code Online (Sandbox Code Playgroud)

gradle spring-boot

4
推荐指数
1
解决办法
6157
查看次数

CodeBuild 中的 Git SHA?

当源代码由 CodeCommit 管理时,如何从 CodeBuild 构建获取提交的 Git SHA?

与任何其他 Git 存储库一样,每个 CodeCommit 提交都会获得一个唯一的 Git SHA。当 CodeBuild 执行时,可以从CODEBUILD_RESOLVED_SOURCE_VERSIONbuildspec.yml环境变量中读取 Git SHA 。

但是,我想知道 CodeBuild“外部”的 Git SHA,即在由“detail-type”的 CodeBuild 事件触发的 Lambda 函数中:“CodeBuild Build State Change”。不幸的是,如果您阅读文档,您会发现 Git SHA 不是事件数据的一部分。我还尝试调用CodeBuild.batchGetBuilds()函数(因为我从 CodeBuild 事件中知道构建 id),遗憾的是该响应中也没有 Git SHA。

git amazon-web-services aws-codecommit aws-codebuild

4
推荐指数
1
解决办法
3124
查看次数

JAX-RS Jersey - 如何强制响应ContentType?覆盖内容协商

Jersey通过查看accept标头来识别请求.我有一个只接受text/*的请求 - 我如何强制响应是例如application/json?

@POST
@Path("/create")
@Produces(MediaType.APPLICATION_JSON)
public MyResponseObject create() {
    return new MyResponseObject();
}
Run Code Online (Sandbox Code Playgroud)

如果请求被指向创建只接受text/*jersey将返回500.有没有办法解决这个问题?(我无法更改请求接受标头).

jax-rs jersey

3
推荐指数
1
解决办法
3660
查看次数

在AWS SAM中使用!Ref设置环境变量吗?

我正在使用SAM CLI v0.8.1。我正在尝试将环境变量MY_TABLE_VAR设置为资源(MyTableResource)中表的名称。但是,在本地运行我的应用程序时,未定义MY_TABLE_VAR。您能告诉我模板中有什么问题吗,如何正确设置呢?以下是我的SAM模板:

Globals:
    Function:
        Timeout: 30
        Runtime: nodejs8.10        
        Environment:
            Variables:
                MY_TABLE_VAR: !Ref MyTableResource
Resources:
    MyTableResource:
        Type: AWS::Serverless::SimpleTable
        Properties:
          TableName: table1
          PrimaryKey:
            Name: id
            Type: String
          ProvisionedThroughput:
            ReadCapacityUnits: 5
            WriteCapacityUnits: 5
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cli aws-sam-cli aws-sam

2
推荐指数
1
解决办法
1395
查看次数

用于 Quicksight 和 SageMaker 的 AWS Cloudformation?

是否可以将 Quicksight 和 Sagemaker 编写为 cloudformation 脚本?我似乎找不到任何 cloudformation 示例。

amazon-web-services aws-cloudformation

2
推荐指数
1
解决办法
1063
查看次数

1
推荐指数
1
解决办法
2742
查看次数