Wednesday, January 13, 2016

AWS Ant Upload to S3


Use AWS Ant Tasks, an open source library released by AWS in the AWS Labs.

To use it, define the taskdef:
<taskdef resource="taskdefs.xml" classpath="~/.ant/lib/aws-java-sdk-ant-tasks-1.2.3.jar" />

Example of upload task:
<target name="deploy-s3" depends="war">
   <upload-to-s3 bucketName="bucket-name" keyPrefix="folder-name/" continueOnFail="false" awsAccessKeyId="${aws.access.key}" awsSecretKey="${aws.secret.key}">
       <fileset>
           <!-- define files here -->
       </fileset>
   </upload-to-s3>
</target>

Note: As at current time of writing it's broken with Java 8. You'll have to run Ant with Java 7.

References:

No comments:

Post a Comment