小编sam*_*ler的帖子

如何从 Node.js Lambda 函数调用步骤函数?

我正在尝试从 Node.js lambda 函数调用步骤函数。我尝试了该线程的解决方案并更新了实现。

显示错误响应的解决方案,但更新后的代码显示成功响应。但更新后的代码没有调用step函数。

我的代码:


console.log('Loading function');
const AWS = require('aws-sdk');
exports.handler = function(event, context) {
    console.log('Loading step functions');
    const stepFunctions = new AWS.StepFunctions({
    region: 'us-east-2'
});
console.log('Loading init');
module.exports.init = (event, context, callback) => {
console.log('Loading params');
const params = {
        stateMachineArn: 'ARN of My State Machine',
        // input: JSON.stringify({}), Optional if your statemachine requires an application/json input, make sure its stringified 
        name: 'TestExecution' // name can be anything you want, but it should change for …
Run Code Online (Sandbox Code Playgroud)

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

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

Terraform AWS Cloudwatch 警报

这是一个示例cloudwatch_metric_alarm resource

    resource "aws_cloudwatch_metric_alarm" "nlb_healthyhosts" {
  alarm_name          = "alarmname"
  comparison_operator = "LessThanThreshold"
  evaluation_periods  = "1"
  metric_name         = "HealthyHostCount"
  namespace           = "AWS/NetworkELB"
  period              = "60"
  statistic           = "Average"
  threshold           = var.logstash_servers_count
  alarm_description   = "Number of healthy nodes in Target Group"
  actions_enabled     = "true"
  alarm_actions       = [aws_sns_topic.sns.arn]
  ok_actions          = [aws_sns_topic.sns.arn]
  dimensions = {
    TargetGroup  = aws_lb_target_group.lb-tg.arn_suffix
    LoadBalancer = aws_lb.lb.arn_suffix
  }
}
Run Code Online (Sandbox Code Playgroud)

我仍然不明白警报操作参数。在 terraform 文档中,我们有:

Alarm_actions -(可选)当该警报从任何其他状态转换为 ALARM 状态时要执行的操作列表。每个操作都指定为 Amazon 资源名称 (ARN)。

有人可以给我一个具体的例子吗,例如发送电子邮件/和/创建 SNS 主题(没有现有主题 ARN )。

我预先非常感谢您的帮助。

amazon-web-services amazon-cloudwatch terraform

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

Cloudformation 初始化 - 安装 docker

我正在尝试使用 AWSCloudformation init在一些 ec2 实例上安装 docker 和 docker-compose。

在尝试此操作之前,我刚刚成功使用了用户数据

我正在使用这个模板

# Use public Systems Manager Parameter
Parameters:
    LatestAmiId:
    Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
    Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
Resources:
    host1:
    Type: AWS::EC2::Instance
    Metadata:
        AWS::CloudFormation::Init:
            configSets:
                ec2_bootstrap:
                    - install_docker
                    # - install_compose
            install_docker:
                packages:
                    yum:
                        docker: []
                services:
                    sysvinit:
                        docker:
                            enabled: "true"
                            ensureRunning: "true"
                commands:
                    docker_for_ec2_user:
                        command: usermod -G docker ec2-user
            # install_compose:
            #     commands:
            #         compose_for_ec2_user:
            #             command: 
            #               - curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
            #               - chmod +x /usr/local/bin/docker-compose
            #               - …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation

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

Waiter ChangeSetCreateComplete 失败: Waiter 遇到终端故障状态

我正在学习 CloudFormation 教程,这是我的 AWS CloudFormation 模板:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: A starter AWS Lambda function.
Resources:
  helloworldpython3:
    Type: 'AWS::Serverless::Function'
    Properties:
      Handler: app.lambda_handler
      Runtime: python3.6
      CodeUri: src/
      Description: A starter AWS Lambda function.
      MemorySize: 128
      Timeout: 3
      Environment:
        Variables:
          TABLE_NAME: !Ref Table
          REGION_NAME: !Ref AWS::Region
      Events:
        HelloWorldSAMAPI:
          Type: Api
          Properties:
            Path: /hello
            Method: GET
      Policies:
        - DynamoDBCrudPolicy:
            TableName: !Ref Table

Table:
  Type: AWS::Serverless::SimpleTable
  Properties:
    PrimaryKey:
      Name: greeting
      Type: String
    ProvisionedThroughput:
      ReadCapacityUnits: 1
      WriteCapacityUnits: 1
Run Code Online (Sandbox Code Playgroud)

我可以使用 生成最终模板aws cloudformation package。但是当我尝试使用 …

amazon-web-services aws-cloudformation serverless aws-sam

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