git - 使用 CloudFormation 在 CodeCommit 存储库中上传/创建文件

标签 git amazon-web-services aws-cloudformation aws-codecommit

我有一个 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/

相关文章:

git - 停止在 git 中跟踪文件 - 无需在本地或 pull 时删除它

node.js - 应用程序端加入 Node 的 ORM?

amazon-web-services - “GetObject 时发生错误。S3 错误代码 : PermanentRedirect. S3 错误消息:存储桶位于此区域:us-east-1

amazon-web-services - 由于服务 : AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterCombination 导致 Cloudformation 堆栈失败

javascript - 使用无服务器框架在 YML 中的代码块中使用 Javascript Resolver 时出现 AWS::Appsync:Resolver Cloudformation 错误

amazon-web-services - 跨多个 VPC 使用 AWS RDS 实例

git push --force-with-lease 与 --force

c++ - 使用 freeglut 编译问题

git - fork 别人的 github 项目以将其作为 gem 发布的道德和礼仪是什么?

python - 从 numpy、pandas 等大型模块中自动删除未使用的代码