简体   繁体   English

CodePipeline/CodeDeploy 将文件从 S3 移动到 EC2

[英]CodePipeline/CodeDeploy move files from S3 to EC2

I'm using aws-cdk for my architecture and I need one last piece to the puzzle.我正在为我的架构使用 aws-cdk,我需要最后一块拼图。 Is it possible to move files from S3 to specific directories on the EC2 instance?是否可以将文件从 S3 移动到 EC2 实例上的特定目录?

I have my.env file and nginx config files in an S3 bucket and once the update has rolled out using CodePipeline/CodeDeploy I want to move the files into their place.我在 S3 存储桶中有 my.env 文件和 nginx 配置文件,使用 CodePipeline/CodeDeploy 推出更新后,我想将文件移到它们的位置。 I don't want to manage these files on GitHub or by having to SSH into the instance.我不想在 GitHub 上或通过 SSH 进入实例来管理这些文件。

// appspec.yml // 应用规范.yml

files:
  - source: /
    destination: /path/to/webserverdir

Can I use S3 as a source?我可以使用 S3 作为来源吗?

Can I use S3 as a source?我可以使用 S3 作为来源吗?

Sadly, you can't.可悲的是,你不能。 You have to write bash/powershell script which is going to use AWS CLI to perform the copy from S3 to the instance.您必须编写将使用 AWS CLI 执行从 S3 到实例的复制的bash/powershell 脚本 Then you invoke the script as part of your appspec.yml .然后调用该脚本作为appspec.yml的一部分。 In addition to this, your instances will need to have an instance role with permissions to S3 .除此之外,您的实例将需要具有具有S3 权限的实例角色。

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

相关问题 将文件从 ec2 复制到 s3 - Copy files from ec2 to s3 如何使用 AWS CLI 将文件从 EC2 移动到 S3? 一旦传输到 S3,文件应从 EC2 中删除 - How to move files from EC2 to S3 using AWS CLI ? The files should be deleted from EC2 once transferred to S3 尝试使用 EC2 中的 Spark 读取文件列表时,方案“s3”没有文件系统 - No FileSystem for scheme "s3" when trying to read a list of files with Spark from EC2 如何使用 CodePipeline 删除 S3 中的文件 - How to delete files in S3 using CodePipeline 从 S3 备份恢复 Ec2(不是 RDS)上的 MariaDB - restore MariaDB on Ec2 (not RDS) from S3 backup 我应该为我的文件使用 s3 存储桶还是应该只使用我的 ec2 实例 - Should I use an s3 bucket for my files or should I just stick to my ec2 instance api 从 aws s3 cloudfront 到 ec2 的请求 403 错误 - api request 403 error from aws s3 cloudfront to ec2 通过 Bitbucket 管道从 AWS S3 部署到 AWS EC2 - Deploy to AWS EC2 from AWS S3 via Bitbucket Pipelines 无法在 AWS 上的 EC2 实例上从 S3 读取 csv 到 pyspark dataframe - Can't read csv from S3 to pyspark dataframe on a EC2 instance on AWS 当 EC2 实例和 S3 存储桶位于同一区域时,如果我们通过 EC2 实例从 S3 存储桶中获取数据,CloudFront 是否有用? - Does CloudFront is useful if we fetch data from S3 bucket through EC2 Instance when EC2 Instance and S3 bucket are in Same Region?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM