如何启动具有从列表中选择的多个SG的实例

时间:2018-12-13 13:58:17

标签: amazon-web-services amazon-cloudformation

我想启动一个实例并添加多个安全组。我正在使用AWS参数。

 Building with 'Microsoft Visual C++ 2015'.
    cl /c /Zp8 /GR /W3 /EHs /nologo /MD /O2 /Oy- /DNDEBUG /DMEX_COMPILE_FLAG  /DMATLAB_DEFAULT_RELEASE=R2017b  /DUSE_MEX_CMD   /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0   /DMATLAB_MEX_FILE -I"C:\Program Files\MATLAB\R2018a\toolbox\vision\builtins\src\ocvcg\opencv\include" -I"C:\Program Files\MATLAB\R2018a\extern\include" -I"C:\Program Files\MATLAB\R2018a\toolbox\distcomp\gpu\extern\include" -I"..\package_bgs"  -I"C:\Program Files\MATLAB\R2018a\extern\include" -I"C:\Program Files\MATLAB\R2018a\simulink\include" "E:\BAW\study\doctoral\bgslibrary-master\wrapper_matlab\backgroundSubtractor_wrapper.cpp" /FoC:\Users\ihssane\AppData\Local\Temp\mex_62234284571999_12516\backgroundSubtractor_wrapper.obj
    Error using mexOpenCV (line 136)
    backgroundSubtractor_wrapper.cpp
    e:\baw\study\doctoral\bgslibrary-master\wrapper_matlab\mxarray.h(591): warning C4267: 'argument': conversion from 'size_t' to
    'int', possible loss of data
    E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include/opencv2/imgproc/types_c.h(58): error
    C2011: 'CvConnectedComp': 'struct' type redefinition
....
...
....
    C:\Program Files\MATLAB\R2018a\toolbox\vision\builtins\src\ocvcg\opencv\include\opencv2/imgproc/types_c.h(222): note: see
    declaration of 'CV_Luv2LBGR'
    E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include/opencv2/imgproc/types_c.h(223): error
    C2365: 'CV_Luv2LRGB': redefinition; previous definition was 'enumerator'
    C:\Program Files\MATLAB\R2018a\toolbox\vision\builtins\src\ocvcg\opencv\include\opencv2/imgproc/types_c.h(223): note: see
    declaration of 'CV_Luv2LRGB'
    E:/BAW/study/doctoral/bgslibrary-master/package_bgs/opencv-3.4.4/build/install/include/opencv2/imgproc/types_c.h(223): fatal
    error C1003: error count exceeds 100; stopping compilation



    Error in compile (line 3)
    mexOpenCV -v -DMEX_COMPILE_FLAG -I"../package_bgs" backgroundSubtractor_wrapper.cpp ...

使用!Ref(请参阅下文),我收到一个错误:SecurityGroupIds属性的值必须为String列表类型

    "SecurityGroupID": {
        "Description": "Select one Security Group ID (Must be available to the VPC)",
        "Type": "List<AWS::EC2::SecurityGroup::Id>"
    },

它与Select一起使用,但仅返回列表中的第一个SG。我想在SecurityGroupIds中获得SG的完整列表。

“ SecurityGroupIds”:[{“ Fn :: Select”:[“ 0”,{“ Ref”:“ SecurityGroupID”}]}]],

谢谢

1 个答案:

答案 0 :(得分:1)

您指定SecurityGroupID参数是一个列表,但是随后在列表构造中引用了该参数。因此,您正在尝试将列表列表分配给仅接受列表的属性。

更改您的Properties属性,使其看起来像这样(如@jarmod在评论中所说):

"Properties" : {
    "SecurityGroupIds" : {"Ref": "SecurityGroupID"},
}

如果您将参数命名为SecurityGroupIDs,也很容易混淆,以使其明显是列表。