【问题标题】:Upload/Create files in CodeCommit repo using CloudFormation使用 CloudFormation 在 CodeCommit 存储库中上传/创建文件
【发布时间】:2020-07-22 05:15:04
【问题描述】:

我有一个创建 CodePipeline 管道的 CloudFormation 模板,包括作为源代码的 CodeCommit 存储库。我有制作 repo 的 CloudFormation 模板,但即使在阅读了链接到 [在此功能公告中][1] 的文档之后,我仍然完全不知道该怎么做才能使 CodeCommit 具有初始提交包含我在启动 CloudFormation 时需要运行的三个文件(两个 JSON,一个 python)。如何从我的模板链接到 s3 存储桶?或者,有人知道我是否可以假设将三个代码文件的全文粘贴在 CloudFormation 模板中?任何让它在开始时提交文件的解决方案都是可以接受的。我的模板中生成 repo 的部分如下所示:

        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.

【问题讨论】:

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


    【解决方案1】:

    您必须将 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
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-23
      • 1970-01-01
      • 2020-07-29
      • 2021-10-26
      • 2020-11-29
      • 1970-01-01
      • 2018-06-07
      • 2019-10-25
      相关资源
      最近更新 更多