[英]Using S3 upload to trigger Lambda function to create EBS volume, which would create EBS volume based on S3 upload size (using boto3)
目前,我正在使用 S3 觸發器在將文件放入 S3 后啟動 lambda 函數。
我的目的是從 S3 上傳中獲取大小並將該值傳遞到創建 EBS 卷的自動化函數中的Size
字段。
我試圖然后根據文件大小創建一個 EBS 卷。 然后將文件復制到 EBS 卷,該卷將附加到隨后將處理該文件的 EC2 實例。 我使用 EBS 卷是因為上傳到主 S3 存儲桶的文件是需要解壓縮和處理的壓縮文件。
有沒有辦法根據上傳的原始文件創建 EBS 卷Size
?
response = client.create_volume(
AvailabilityZone='string',
Encrypted=True|False,
Iops=123,
KmsKeyId='string',
OutpostArn='string',
Size=123,
SnapshotId='string',
VolumeType='standard'|'io1'|'gp2'|'sc1'|'st1',
DryRun=True|False,
TagSpecifications=[
{
'ResourceType': 'client-vpn-endpoint'|'customer-gateway'|'dedicated-host'|'dhcp-options'|'elastic-ip'|'fleet'|'fpga-image'|'host-reservation'|'image'|'instance'|'internet-gateway'|'key-pair'|'launch-template'|'natgateway'|'network-acl'|'network-interface'|'placement-group'|'reserved-instances'|'route-table'|'security-group'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-multicast-domain'|'transit-gateway-route-table'|'volume'|'vpc'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log',
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
},
],
MultiAttachEnabled=True|False
)
您的目標似乎是讓 Amazon EC2 實例處理已上傳到 Amazon S3 的文件。
首先,無需通過 Amazon EBS 卷發送文件。 相反,在 EC2 實例上運行的軟件可以簡單地從 S3 檢索。
主要的架構決策是在文件上傳后如何觸發 EC2 實例上的流程。
我會推薦這種架構:
或者,如果可能,您可以在不使用 Amazon EC2 實例的情況下在 AWS Lambda 中處理文件。 但是,您沒有在問題中提供足夠的信息來確定這是否可行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.