Skip to content

The gradle task for synchronizing a local directory with a AWS S3 bucket.

Notifications You must be signed in to change notification settings

karmazyn/gradle-aws-s3-sync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the gradle task for synchronizing a local directory with a AWS S3 bucket and vice-versa.

This task depends on JetS3t, a open-source Java toolkit for AWS.

Situation - upload

This task assumes the case, for example, a web site would be published in a AWS S3 bucket.

Usage - upload

// Gradle Script
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath "com.monochromeroad.gradle-plugins:gradle-aws-s3-sync:0.5"
    }
}

import com.monochromeroad.gradle.plugin.aws.s3.S3Sync

task deploy(type: S3Sync){
    description = "Deploys my site on a s3 bucket."

    accessKey awsAccessKey
    secretKey awsSecretKey

    configFile "synchronizer.properties"

    from "local-site"
    into "my.bucket.name/subdirectory-optional"
}

Situation - download

This task assumes the case, for example, a set of files has to be fetched from an S3 bucket to a local directory.

Usage - download

// Gradle Script
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath "com.monochromeroad.gradle-plugins:gradle-aws-s3-sync:0.5"
    }
}

import com.monochromeroad.gradle.plugin.aws.s3.S3Sync

task deploy(type: S3Sync){
    description = "Downloads files from s3 bucket to a local directory"

    accessKey awsAccessKey
    secretKey awsSecretKey

    configFile "synchronizer.properties"
    
    // follows the jets3t conventions for action names
    action = 'DOWN'

    from "my.bucket.name/subdirectory-optional"
    from "local-site"
}

Options

Name * required Description Default Value
* accessKey() AWS Access Key -
* secretKey() AWS Secret Key -
* from() The local directory which would be synchronized with the S3 bucket -
* into() The S3 bucket name which would be synchronized with the local directory. If needed, some sub directory could be added. (e.g. buc.ket/sub.d) -
configFile() JetS3t properties file path. Interpreted relative to the project directory, as for project.file() method. -
See also: JetS3t's Default
quiet() JetS3t option -q false
noProgress() JetS3t option -n false
force() JetS3t option -f false
keepFiles() JetS3t option -k false
noDelete() JetS3t option -d false
moveEnabled() JetS3t option -m false
batchMode() JetS3t option -b false
gzipEnabled() JetS3t option -g false
encryptionEnabled() JetS3t option -c false
acl() JetS3t option --acl, from enum "ACL" com.monochromeroad.gradle.plugin.aws.s3.ACL.Private
reportLevel(ReportLevel) JetS3t option --reportlevel, from enum "ReportLevel" com.monochromeroad.gradle.plugin.aws.s3.ReportLevel.All
action() Either 'UP' for uploading into S3 or 'DOWN' for downloading from S3. UP

About

The gradle task for synchronizing a local directory with a AWS S3 bucket.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Groovy 100.0%