This step app is a modification of wercker/step-s3sync to do a put
instead of a sync
It uses the command s3cmd put
to copy a folder or a file.
Use the option opts --recursive
to copy a folder with all it's files recursively into the S3 bucket. See http://s3tools.org/usage
The synchronized files will get an public access level.
It is recommended that you use application and deployment variables in wercker, so you don't include any private keys in your code.
- Always display s3cmd output
key-id
(required) The Amazon Access key that will be used for authorization.key-secret
(required) The Amazon Access secret that will be used for authorization.bucket-url
(required) The url of the bucket to sync to, like:s3://wercker.com
source-dir
(optional, default:./
) The directory to copy to the remote bucket.opts
(optional, default:--acl-public
) Arbitrary options provided to s3cmd. Sees3cmd --help
for more.
deploy:
steps:
- s3sync:
key-id: $KEY
key-secret: $SECRET
bucket-url: $BUCKET
source-dir: $SOURCE
opts: --acl-private
By default s3sync will make the files publicly available from your S3 bucket, but you can use the "opts" option to manually specify an ACL option to s3cmd. At the time of writing, these are:
-P, --acl-public Store objects with ACL allowing read for anyone.
--acl-private Store objects with default ACL allowing access for you
only.
--acl-grant=PERMISSION:EMAIL or USER_CANONICAL_ID
Grant stated permission to a given amazon user.
Permission is one of: read, write, read_acp,
write_acp, full_control, all
It's a good idea to create a IAM user which just has enough permissions to be able to sync to the S3 buckets that it needs to. The IAM user needs the following permissions to be able to sync a bucket (replace [bucket_name]
with the bucket name):
{
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::[bucket_name]",
"arn:aws:s3:::[bucket_name]/*"
]
}
]
}
The MIT License (MIT)
Update s3cmd
- Fork from https://github.com/wercker/step-s3sync
- Change
sync
toput
- Always display s3cmd output
- Fix
source-dir
bug
- Refactor run.sh
- Update s3cmd to 1.5.1.2
- Bundle s3cmd in step
- Add
delete-removed
parameter
- Add information about permissions to the README
- Initial release