无服务器框架从 CloudFormation 模板为 S3 Bucket 创建额外的字符
Serverless Framework creating extra characters for S3 Bucket from CloudFormation Template
所以,我猜这可能有一个直接的答案(希望如此),但我正在尝试创建一个 AWS Lambda 函数来处理 csv 文件并将处理后的文件放在不同的 s3 存储桶中(取决于关于正在转换和生成的内容)。
在执行此操作时,我使用的是无服务器框架和 CloudFormation,但我注意到在创建存储桶时,它们附加了无关的值以及服务名称。例如:
桶:
new-process-2-dev-companyprocessedsalestotal08252-jdgsd2ljyqpx
本来就是:
companyprocessedsalestotal08252
Yaml 文件在下方,我使用 CloudFormation 资源生成其他存储桶。我该如何解决这个命名惯例?
service: new-process-2
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
resources:
Resources:
companyincoming08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
companyprocessedsalestotal08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
compnayprocessedwinloss08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
companyemployeestargetotal08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
companyemployeesalespivot08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
provider:
name: aws
runtime: python3.8
region: us-east-1
profile: serverless-admin
timeout: 120
memorySize: 128
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:*"
Resource: "*"
functions:
csv-processor:
handler: handler.featureengineering
events:
- s3:
bucket: companyincoming08252020
event: s3:ObjectCreated:*
rules:
- suffix: .csv
custom:
pythonRequirements:
dockerizePip: true
plugins:
- serverless-python-requirements
- serverless-s3-deploy
需要为正在创建的存储桶定义名称 属性。如果省略此项,则 CloudFormation 将为存储桶生成一个名称:
If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID for the bucket name
在 CFT 中,属性 是 BucketName
,或者如果在无服务器文件中定义,则这只是 name
此处无服务器信息:https://www.serverless.com/framework/docs/providers/aws/events/s3#custom-bucket-configuration
所以,我猜这可能有一个直接的答案(希望如此),但我正在尝试创建一个 AWS Lambda 函数来处理 csv 文件并将处理后的文件放在不同的 s3 存储桶中(取决于关于正在转换和生成的内容)。
在执行此操作时,我使用的是无服务器框架和 CloudFormation,但我注意到在创建存储桶时,它们附加了无关的值以及服务名称。例如:
桶:
new-process-2-dev-companyprocessedsalestotal08252-jdgsd2ljyqpx
本来就是:
companyprocessedsalestotal08252
Yaml 文件在下方,我使用 CloudFormation 资源生成其他存储桶。我该如何解决这个命名惯例?
service: new-process-2
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
resources:
Resources:
companyincoming08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
companyprocessedsalestotal08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
compnayprocessedwinloss08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
companyemployeestargetotal08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
companyemployeesalespivot08252020:
Type: 'AWS::S3::Bucket'
Properties: {}
provider:
name: aws
runtime: python3.8
region: us-east-1
profile: serverless-admin
timeout: 120
memorySize: 128
iamRoleStatements:
- Effect: "Allow"
Action:
- "s3:*"
Resource: "*"
functions:
csv-processor:
handler: handler.featureengineering
events:
- s3:
bucket: companyincoming08252020
event: s3:ObjectCreated:*
rules:
- suffix: .csv
custom:
pythonRequirements:
dockerizePip: true
plugins:
- serverless-python-requirements
- serverless-s3-deploy
需要为正在创建的存储桶定义名称 属性。如果省略此项,则 CloudFormation 将为存储桶生成一个名称:
If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID for the bucket name
在 CFT 中,属性 是 BucketName
,或者如果在无服务器文件中定义,则这只是 name
此处无服务器信息:https://www.serverless.com/framework/docs/providers/aws/events/s3#custom-bucket-configuration