搭配使用 DeleteFlowLogs 與 CLI - AWS SDK 程式碼範例

AWS文件開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。

搭配使用 DeleteFlowLogs 與 CLI

下列程式碼範例示範如何使用 DeleteFlowLogs

CLI
AWS CLI

刪除流量日誌

以下 delete-flow-logs 範例會刪除指定的流量日誌。

aws ec2 delete-flow-logs --flow-log-id fl-11223344556677889

輸出:

{ "Unsuccessful": [] }
  • 如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 DeleteFlowLogs

PowerShell
Tools for PowerShell V4

範例 1:此範例會移除給定的 FlowLogId fl-01a2b3456a789c01

Remove-EC2FlowLog -FlowLogId fl-01a2b3456a789c01

輸出:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2FlowLog (DeleteFlowLogs)" on target "fl-01a2b3456a789c01". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》中的 DeleteFlowLogs

Tools for PowerShell V5

範例 1:此範例會移除給定的 FlowLogId fl-01a2b3456a789c01

Remove-EC2FlowLog -FlowLogId fl-01a2b3456a789c01

輸出:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-EC2FlowLog (DeleteFlowLogs)" on target "fl-01a2b3456a789c01". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
  • 如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》中的 DeleteFlowLogs