Search code examples
amazon-web-servicesamazon-s3file-uploadchef-infracookbook

Upload a file to S3 using Chef


I am automating installation of a distributed software using Chef. It has multiple nodes and on the master node, it creates an encryption key in a file. That file should be present on all the slave nodes. I was planning to publish this file to S3 from master node and download it on slave nodes. I know we can use s3_file cookbook to download file from s3. I don't know how to upload a file to s3 in Chef. So, looking for suggestion how can I upload to S3 or what is other workaround if s3 uploading is not available. thanks


Solution

  • You can use AWS CLI to upload a file to s3. If it is windows then use PowerShell to upload a file otherwise use a terminal script to do so. First, you need to install AWS CLI and then use AWS s3 cp command to upload a local file to AWS.