我有一个 CloudFormation 模板,用于创建 CodePipeline 管道,包括 CodeCommit 存储库作为源代码。我有 CloudFormation 模板来制作存储库,但即使在阅读了链接到 [在此功能公告中][1] 的文档后,我仍然完全不知道如何制作它,以便 CodeCommit 具有初始提交包含我需要在启动 CloudFormation 时运行的三个文件(两个 JSON,一个 python)。如何从我的模板链接到 s3 存储桶?或者,有人知道我是否可以假设将三个代码文件的全文粘贴在 CloudFormation 模板中?任何能够在启动时提交文档的解决方案都是可以接受的。我的模板中使存储库看起来像这样的部分:
Type: "AWS::CodeCommit::Repository"
Properties:
RepositoryName: "ID"
RepositoryDescription: "Holds template for CloudFormation, buildspec, and Lambda for IDAPI" ```
[1]: https://aws.amazon.com/about-aws/whats-new/2015/10/aws-identity-and-access-management-iam-policy-simulator-now-helps-you-test-resource-level-permissions/#:~:text=Using%20the%20IAM%20policy%20simulator,that%20you%20wish%20to%20verify.
最佳答案
您必须将 zip 包中的三个文件上传到 S3。然后,在 CloudFormation 中,当您在 Code 中创建存储库时,您将引用该内容。参数。
例如:
Type: "AWS::CodeCommit::Repository"
Properties:
RepositoryName: "ID"
RepositoryDescription: "Holds template for CloudFormation, buildspec, and Lambda for IDAPI"
Code:
S3:
Bucket: <bucket-with-your-zip>
Key: <key-of-the-zip> # aka filename
ObjectVersion: <version-number> # optional version number
关于git - 使用 CloudFormation 在 CodeCommit 存储库中上传/创建文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63022588/