Home > Software design >  CodePipeline/CodeDeploy move files from S3 to EC2
CodePipeline/CodeDeploy move files from S3 to EC2

Time:10-13

I'm using aws-cdk for my architecture and I need one last piece to the puzzle. Is it possible to move files from S3 to specific directories on the EC2 instance?

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. I don't want to manage these files on GitHub or by having to SSH into the instance.

// appspec.yml

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

Can I use S3 as a source?

CodePudding user response:

Can I use S3 as a source?

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. Then you invoke the script as part of your appspec.yml. In addition to this, your instances will need to have an instance role with permissions to S3.

  • Related