小编AWS*_*per的帖子

来自 Step Function 的跨账户 Lambda 调用

我在账户 A 中有 Step Function,在账户 B 中有 lambda。但是在运行 step 函数时,它给出:

An error occurred while executing the state 'lambdaB' (entered at the event id #2). The resource belongs to a different account from the running execution.
Run Code Online (Sandbox Code Playgroud)

有什么办法可以实现这种配置。

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

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

如何将逗号和分号分隔的字符串拆分为 JSON 对象

我无法格式化以下字符串:

"Sony,20,30,40;LG,1,4,8"
Run Code Online (Sandbox Code Playgroud)

以下 JSON 格式:

"reported": {
    "SETS": [
      {
        "prodName": "Sony",
        "fmtd": "20",
        "lmtd": "30",
        "lm": "40"
      },
      {
        "prodName": "LG",
        "mtd": "1",
        "lmtd": "4",
        "lm": "8"
      }
    ]
  }
Run Code Online (Sandbox Code Playgroud)

我尝试了下面的代码,但没有得到正确的结果。

String stringFromProc = "SONY,20,30,40;LG,1,4,8";
String[] array1 =  stringFromProc.split("[\\;]");
JSONObject jsonSubObject = null;
JSONObject jsonFinal = new JSONObject();
JSONArray jsonArrayRET = new JSONArray();

for(int i=0;i<array1.length;i++){
    String []array2 = array1[i].split("[\\,]");
    for(int j=0;j<array2.length;j++){
        System.out.println(array2[j]);
        jsonSubObject = new JSONObject();

        jsonSubObject.put("prodName", array2[0]);
        jsonSubObject.put("mtd", array2[1]);
        jsonSubObject.put("lmtd", array2[2]);
        jsonSubObject.put("lm", array2[3]);
        jsonArrayRET.add(jsonSubObject);
        jsonFinal.put("reported", jsonArrayRET);
    }
} …
Run Code Online (Sandbox Code Playgroud)

java string json

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

如何获取 AWS KMS Key Arn 并通过 CloudFormation 将其传递到 IAM 角色内联策略中?

我正在尝试通过 CloudFormation 模板创建 IAM 角色和 KMS 密钥。我的要求是首先我需要创建 KMS 密钥,获取它的 ARN,然后在创建 IAM 角色时,必须传递该 KMS ARN。我的政策是这样的:

Resources:
  myKey:
    Type: AWS::KMS::Key
    Properties:
      Description: Key for encrypting S3 Buckets
      Enabled: TRUE
      KeyPolicy:
        Version: '2012-10-17'
        Statement:
          - Sid: Enable IAM User Permissions
            Effect: Allow
            Principal:
              AWS: arn:aws:iam::11111111:root
            Action: kms:*
            Resource: '*'
      KeyUsage:  ENCRYPT_DECRYPT
  myAlias:
    Type: AWS::KMS::Alias
    Properties:
      AliasName: alias/key_for_s3_encrytpion
      TargetKeyId:
        Ref: myKey
  RootRole:
      Type: 'AWS::IAM::Role'
      Properties:
        RoleName: 'Lambda-S3-SNS-VPC-Role-cft'
        AssumeRolePolicyDocument:
          Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - lambda.amazonaws.com
              Action:
                - 'sts:AssumeRole'
        Path: /
        ManagedPolicyArns: …
Run Code Online (Sandbox Code Playgroud)

aws-cloudformation amazon-iam amazon-kms

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

本地 IBM MQ 与 AWS 集成

有没有一种方法可以在本地 IBM MQ 与 AWS SQS/API Gateway 之间进行集成。我检查了很多链接,但发现我们可以将整个 IBM MQ 迁移到 AWS MQ,但无法从 AWS 调用到本地MQ。如果有人尝试过这种集成,请提出建议。

amazon-sqs amazon-web-services aws-api-gateway ibm-mq

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