本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
從範本建立工作流程
您可以部署堆疊 AWS CloudFormation ,以從範本建立工作流程和伺服器。此程序包含一個範例,您可以用來快速部署工作流程。
建立建立 AWS Transfer Family 工作流程和伺服器的 AWS CloudFormation 堆疊
-
在 https://console.aws.amazon.com/cloudformation 開啟 AWS CloudFormation 主控台。
-
將下列程式碼儲存至 檔案。
- YAML
-
AWSTemplateFormatVersion: 2010-09-09
Resources:
SFTPServer:
Type: 'AWS::Transfer::Server'
Properties:
WorkflowDetails:
OnUpload:
- ExecutionRole: workflow-execution-role-arn
WorkflowId: !GetAtt
- TransferWorkflow
- WorkflowId
TransferWorkflow:
Type: AWS::Transfer::Workflow
Properties:
Description: Transfer Family Workflows Blog
Steps:
- Type: COPY
CopyStepDetails:
Name: copyToUserKey
DestinationFileLocation:
S3FileLocation:
Bucket: archived-records
Key: ${transfer:UserName}/
OverwriteExisting: 'TRUE'
- Type: TAG
TagStepDetails:
Name: tagFileForArchive
Tags:
- Key: Archive
Value: yes
- Type: CUSTOM
CustomStepDetails:
Name: transferExtract
Target: arn:aws:lambda:region
:account-id
:function:function-name
TimeoutSeconds: 60
- Type: DELETE
DeleteStepDetails:
Name: DeleteInputFile
SourceFileLocation: '${original.file}'
Tags:
- Key: Name
Value: TransferFamilyWorkflows
- JSON
-
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"SFTPServer": {
"Type": "AWS::Transfer::Server",
"Properties": {
"WorkflowDetails": {
"OnUpload": [
{
"ExecutionRole": "workflow-execution-role-arn
",
"WorkflowId": {
"Fn::GetAtt": [
"TransferWorkflow",
"WorkflowId"
]
}
}
]
}
}
},
"TransferWorkflow": {
"Type": "AWS::Transfer::Workflow",
"Properties": {
"Description": "Transfer Family Workflows Blog",
"Steps": [
{
"Type": "COPY",
"CopyStepDetails": {
"Name": "copyToUserKey",
"DestinationFileLocation": {
"S3FileLocation": {
"Bucket": "archived-records",
"Key": "${transfer:UserName}/"
}
},
"OverwriteExisting": "TRUE"
}
},
{
"Type": "TAG",
"TagStepDetails": {
"Name": "tagFileForArchive",
"Tags": [
{
"Key": "Archive",
"Value": "yes"
}
]
}
},
{
"Type": "CUSTOM",
"CustomStepDetails": {
"Name": "transferExtract",
"Target": "arn:aws:lambda:region
:account-id
:function:function-name
",
"TimeoutSeconds": 60
}
},
{
"Type": "DELETE",
"DeleteStepDetails": {
"Name": "DeleteInputFile",
"SourceFileLocation": "${original.file}"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": "TransferFamilyWorkflows"
}
]
}
}
}
}
-
將下列項目取代為您的實際值。
-
Replace (取代) workflow-execution-role-arn
使用 ARN 做為實際工作流程執行角色。例如 arn:aws:transfer:us-east-2:111122223333:workflow/w-1234567890abcdef0
-
arn:aws:lambda:region
:account-id
:function:function-name
將 取代為 Lambda 函數ARN的 。例如:arn:aws:lambda:us-east-2:123456789012:function:example-lambda-idp
。
-
請遵循 AWS CloudFormation 使用者指南 中的 AWS CloudFormation 從現有範本部署堆疊的指示。
部署堆疊之後,您可以在 CloudFormation 主控台的輸出索引標籤中檢視其詳細資訊。範本會 AWS Transfer Family SFTP建立新的伺服器,以使用者服務受管使用者,以及新的工作流程,並將工作流程與新伺服器建立關聯。