Skip to content

Instantly share code, notes, and snippets.

@marlhammer
Created June 25, 2014 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marlhammer/12fd3ddb772a161235bd to your computer and use it in GitHub Desktop.
Save marlhammer/12fd3ddb772a161235bd to your computer and use it in GitHub Desktop.
AWS Example (Glacier)
import java.io.File;
import com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.glacier.AmazonGlacierClient;
import com.amazonaws.services.glacier.transfer.ArchiveTransferManager;
import com.amazonaws.services.glacier.transfer.UploadResult;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.PutObjectRequest;
public class AwsExampleGlacier {
public static void main(String[] args) throws Exception {
AmazonGlacierClient client = new AmazonGlacierClient(new ClasspathPropertiesFileCredentialsProvider());
client.setRegion(Region.getRegion(Regions.US_WEST_2));
ArchiveTransferManager atm = new ArchiveTransferManager(client, new ClasspathPropertiesFileCredentialsProvider());
UploadResult result = atm.upload(
"Backup",
"glacierJava.txt",
new File("glacierJava.txt")
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment