Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.antrego:gradle-aws-plugin:'
}
dependencies {
implementation("com.github.antrego:gradle-aws-plugin:")
}
<dependency>
<groupId>com.github.antrego</groupId>
<artifactId>gradle-aws-plugin</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.antrego" % "gradle-aws-plugin" % ""
:dependencies [[com.github.antrego/gradle-aws-plugin ""]]
Gradle plugin to manage AWS resouces.
Add like this to your build.gradle :
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "jp.classmethod.aws:gradle-aws-plugin:0.21"
}
}
apply plugin: 'jp.classmethod.aws'
aws {
profileName = 'credentials-profile-name-in-your-profile-configuration-file (~/.aws/credentials)'
region = 'ap-northeast-1'
}
These credentials are used to make API accesses by default. The format of the credentials file is described in the Amazon AWS Docs.
apply plugin: 'jp.classmethod.aws.s3'
task syncObjects(type: jp.classmethod.aws.gradle.s3.SyncTask) {
bucketName 'foobar.example.com'
source file('path/to/objects')
}
Look S3 example 1 and S3 example 2 for more information.
apply plugin: 'jp.classmethod.aws.ec2'
// You can overwrite default credentials and region settings like this:
// ec2 {
// profileName 'another-credentials-profile-name' // optional
// region = 'us-east-1'
// }
task stopBastion(type: jp.classmethod.aws.gradle.ec2.AmazonEC2StopInstanceTask) {
instanceIds += 'i-12345678'
}
task startBastion(type: jp.classmethod.aws.gradle.ec2.AmazonEC2StartInstanceTask) {
instanceIds += 'i-12345678'
}
Look EC2 example for more information.
apply plugin: "jp.classmethod.aws.rds"
// You can overwrite default credentials and region settings like this:
// rds {
// profileName 'another-credentials-profile-name' // optional
// region = 'us-east-1'
// }
task migrateDBInstance(type: AmazonRDSMigrateDBInstanceTask) {
dbInstanceIdentifier = "foobar"
allocatedStorage = 5
dbInstanceClass = "db.t2.micro"
engine = "MySQL"
masterUsername = "root"
masterUserPassword = "passW0rd"
vpcSecurityGroupIds = [ "sg-d3958fbf" ]
dbSubnetGroupName = "default"
multiAZ = false
publiclyAccessible = true
}
task rebootDBInstance(type: AmazonRDSRebootDBInstanceTask) {
dbInstanceIdentifier = "foobar"
}
task deleteDBInstance(type: AmazonRDSDeleteDBInstanceTask) {
dbInstanceIdentifier = "foobar"
skipFinalSnapshot = true
}
Look RDS example for more information.
apply plugin: 'jp.classmethod.aws.route53'
ask createHostedZone(type: jp.classmethod.aws.gradle.route53.CreateHostedZoneTask) {
hostedZoneName "foobar.example.com"
callerReference '0BF44985-9D79-BF3B-A9B0-5AE24D6E86E1'
}
task deleteHostedZone(type: jp.classmethod.aws.gradle.route53.DeleteHostedZoneTask) {
hostedZoneId "XXXX"
}
Look Route 53 example for more information.
apply plugin: 'jp.classmethod.aws.beanstalk'
beanstalk {
String extension = project.war.archiveName.tokenize('.').last()
String timestamp = new Date().format("yyyyMMdd'_'HHmmss", TimeZone.default)
appName 'foobar'
appDesc 'foobar demo application'
version {
label = "foobar-${project.war.version}-${timestamp}"
description = "${artifactId} v${version}"
bucket = 'sample-bucket'
key = "eb-apps/foobar-${project.war.version}-${timestamp}.${extension}"
}
configurationTemplates {
production {
optionSettings = file('src/main/config/production.json')
solutionStackName = '64bit Amazon Linux 2013.09 running Tomcat 7 Java 7'
}
development {
optionSettings = file('src/main/config/development.json')
solutionStackName = '64bit Amazon Linux 2013.09 running Tomcat 7 Java 7'
}
}
environment {
envName = 'foobar'
envDesc = 'foobar demo application development environemnt'
templateName = 'development'
versionLabel = "foobar-${project.war.version}-${timestamp}"
}
}
// task awsEbMigrateEnvironment, awsEbDeleteApplication and so on are declared
Look Elastic Beanstalk example for more information.
apply plugin: 'jp.classmethod.aws.cloudformation'
cloudFormation {
stackName 'foobar-stack'
stackParams([
Foo: 'bar',
Baz: 'qux'
])
capabilityIam true
templateFile project.file("foobar.template")
templateBucket 'example-bucket'
templateKeyPrefix 'foobar/'
}
// awsCfnMigrateStack and awsCfnDeleteStack task (and so on) is declared.
Look CloudFormation example for more information.
apply plugin: "base"
apply plugin: "jp.classmethod.aws.lambda"
aws {
profileName = "default"
region = "ap-northeast-1"
}
lambda {
region = "us-east-1"
}
task zip(type: Zip) {
from "function/"
destinationDir file("build")
}
task migrateFunction(type: AWSLambdaMigrateFunctionTask, dependsOn: zip) {
functionName = "foobar"
role = "arn:aws:iam::${aws.accountId}:role/lambda-poweruser"
zipFile = zip.archivePath
handler = "DecodeBase64.handler"
}
task invokeFunction(type: AWSLambdaInvokeTask) {
functionName = "foobar"
invocationType = InvocationType.RequestResponse
payload = file("sample-input/input.txt")
doLast {
println "Lambda function result: " + new String(invokeResult.payload.array(), "UTF-8")
}
}
task deleteFunction(type: AWSLambdaDeleteFunctionTask) {
functionName = "foobar"
}
Look Lambda example for more information.
Copyright (C) 2013-2015 Classmethod, Inc.
Distributed under the Apache License v2.0. See the file copyright/LICENSE.txt.
We will open for contributions.
To contribute to the plugin or make your own modifications, including the ability to publish your build artifacts to your own maven repository see: development.