简体   繁体   English

Chef 12 + AWS Opsworks + s3部署的应用程序

[英]Chef 12 + AWS Opsworks + Deploy App from s3

I Needed to setup a deployment process using AWS Opsworks. 我需要使用AWS Opsworks设置部署流程。 I have created my stack and added respective layers. 我已经创建了堆栈并添加了相应的图层。 I have configured my application and which basically a war archive stored in s3 bucket 我已经配置了我的应用程序,并且基本上将战争存档存储在s3存储桶中

When I trigger a deploy event for the app, My recipe is getting executed, but the Problem is i am getting an s3 url. 当我触发该应用程序的部署事件时,我的食谱正在执行,但是问题是我正在获取s3网址。 There is no official aws sdk which supports s3 file copy using s3 url. 没有官方的AWS SDK可以使用s3网址支持s3文件复制。

One way i can split the url and get the bucket key and region from it and can use it with aws sdk. 我可以拆分URL并从中获取存储桶键和区域的一种方法,可以将其与AWS SDK一起使用。 But What is the right way to do it. 但是什么是正确的方法。 Is there any other library i can use. 还有其他我可以使用的图书馆。

Asking this question to understand what is the right procedure to do it. 询问此问题以了解执行此操作的正确步骤。

Looking at the s3_file cookbook , you can indeed specify a full s3 url: 查看s3_file食谱 ,您确实可以指定完整的s3网址:

s3_file "/tmp/somefile" do
    remote_path "/my/s3/key"
    bucket "my-s3-bucket"
    aws_access_key_id "mykeyid"
    aws_secret_access_key "mykey"
    s3_url "https://s3.amazonaws.com/bucket"
    owner "me"
    group "mygroup"
    mode "0644"
    action :create
    decryption_key "my SHA256 digest key"
    decrypted_file_checksum "SHA256 hex digest of decrypted file"
end

AWS maintains a cookbook for integration with its various services. AWS维护用于与其各种服务集成的食谱。 The s3_file resource should be able to accomplish what you need. s3_file资源应该能够完成您所需要的。 Here's an example from their readme: 这是他们自述文件中的一个示例:

aws_s3_file '/tmp/foo' do
  bucket 'i_haz_an_s3_buckit'
  remote_path 'path/in/s3/bukket/to/foo'
  aws_access_key aws['aws_access_key_id']
  aws_secret_access_key aws['aws_secret_access_key']
  region 'us-west-1'
end

You can include this in your cookbook by adding it as a dependency in your metadata.rb (ensure you have the cookbook downloaded and in your local cookbooks path). 您可以通过将其作为依赖项添加到您的食谱中,方法是将其作为依赖项添加到您的meta.rb中(确保您已下载该食谱并在本地食谱路径中)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM