

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在基础架构编辑器中断开卡的连接
<a name="reference-navigation-gestures-disconnect"></a>

在 Infrastructure Composer 中，您可以使用*增强的组件卡*和*标准组件卡*来连接和断开 AWS 资源。本节介绍如何断开两种类型的卡的连接。

## 增强的组件卡
<a name="using-composer-connecting-enhanced-disconnect"></a>

要断开增强型组件卡的连接，请选择该线路并选择 “**断开连接**”。

![\[API Gateway 卡与 Lambda 函数断开连接。\]](http://docs.aws.amazon.com/zh_cn/infrastructure-composer/latest/dg/images/aac_use_con_03.png)


Infrastructure Composer 将自动修改您的模板，以从您的应用程序中删除事件驱动的关系。

## 标准组件卡
<a name="w2aac17c31b7"></a>

标准组件卡不包括用于与其他资源建立连接的端口。在[配置卡片](using-composer-standard-cards.md)期间，您可以在应用程序的模板中指定事件驱动的关系，Infrastructure Composer 将自动检测这些连接，并在卡片之间用虚线将它们可视化。要断开标准组件卡的连接，请移除应用程序模板中的事件驱动关系。

以下示例显示了与 Amazon API Gateway rest API 关联的 Lambda 函数：

```
AWSTemplateFormatVersion: '2010-09-09'
Resources:
  MyApi:
    Type: 'AWS::ApiGateway::RestApi'
    Properties:
      Name: MyApi

  ApiGatewayMethod:
    Type: 'AWS::ApiGateway::Method'
    Properties:
      HttpMethod: POST  # Specify the HTTP method you want to use (e.g., GET, POST, PUT, DELETE)
      ResourceId: !GetAtt MyApi.RootResourceId
      RestApiId: !Ref MyApi
      AuthorizationType: NONE
      Integration:
        Type: AWS_PROXY
        IntegrationHttpMethod: POST
        Uri: !Sub
          - arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunctionArn}/invocations
          - { LambdaFunctionArn: !GetAtt MyLambdaFunction.Arn }
      MethodResponses:
        - StatusCode: 200

  MyLambdaFunction:
    Type: 'AWS::Lambda::Function'
    Properties:
      Handler: index.handler
      Role: !GetAtt LambdaExecutionRole.Arn
      Runtime: nodejs14.x
      Code:
        S3Bucket: your-bucket-name
        S3Key: your-lambda-zip-file.zip

  LambdaExecutionRole:
    Type: 'AWS::IAM::Role'
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: lambda.amazonaws.com
            Action: 'sts:AssumeRole'
      Policies:
        - PolicyName: LambdaExecutionPolicy
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Action:
                  - 'logs:CreateLogGroup'
                  - 'logs:CreateLogStream'
                  - 'logs:PutLogEvents'
                Resource: 'arn:aws:logs:*:*:*'
              - Effect: Allow
                Action:
                  - 'lambda:InvokeFunction'
                Resource: !GetAtt MyLambdaFunction.Arn
```

要移除两张卡片之间的连接，请移除`MyLambdaFunction`下面列出的`ApiGatewayMethod:`内容。`Integration`