All Projects → classmethod → Gradle Aws Plugin

classmethod / Gradle Aws Plugin

Gradle plugin to manage Amazon Web Services

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Gradle Aws Plugin

gradle-build-info-plugin
Gradle plugin to include build information such as Git commit ID to your JAR. It can be used to show Git commit information with Spring Boot Actuator.
Stars: ✭ 33 (-87.73%)
Mutual labels:  gradle, gradle-plugin
sonatype-publish-plugin
Gradle Plugin for publishing artifacts to Sonatype and Nexus
Stars: ✭ 17 (-93.68%)
Mutual labels:  gradle, gradle-plugin
gatling-gradle-plugin-demo
Showcase of the Gatling Plugin for Gradle
Stars: ✭ 17 (-93.68%)
Mutual labels:  gradle, gradle-plugin
gradle-cleaner-intellij-plugin
Force clear delaying & no longer needed Gradle tasks.
Stars: ✭ 26 (-90.33%)
Mutual labels:  gradle, gradle-plugin
jooq-plugin
Plugin for generating jOOQ classes using dockerized databases
Stars: ✭ 55 (-79.55%)
Mutual labels:  gradle, gradle-plugin
sphinx-gradle-plugin
Sphinx site generation plugin for Gradle
Stars: ✭ 19 (-92.94%)
Mutual labels:  gradle, gradle-plugin
SetupBuilder
Gradle plugin for building setups for different platforms.
Stars: ✭ 75 (-72.12%)
Mutual labels:  gradle, gradle-plugin
Gradle Launch4j
A gradle-plugin to create windows executables with launch4j
Stars: ✭ 177 (-34.2%)
Mutual labels:  gradle, gradle-plugin
plugin-yml
A Gradle plugin that generates plugin.yml for Bukkit/BungeeCord/Nukkit plugins based on the Gradle project
Stars: ✭ 42 (-84.39%)
Mutual labels:  gradle, gradle-plugin
gradle-libraries-plugin
No description or website provided.
Stars: ✭ 29 (-89.22%)
Mutual labels:  gradle, gradle-plugin
Badass Jlink Plugin
Create a custom runtime image of your modular application
Stars: ✭ 216 (-19.7%)
Mutual labels:  gradle, gradle-plugin
change-tracker-plugin
A Gradle plugin to help analyse the dependency between modules and run tasks only on modules impacted by specific set of changes.
Stars: ✭ 103 (-61.71%)
Mutual labels:  gradle, gradle-plugin
Gradle Testsets Plugin
A plugin for the Gradle build system that allows specifying test sets (like integration or acceptance tests).
Stars: ✭ 182 (-32.34%)
Mutual labels:  gradle, gradle-plugin
gradle-localization-plugin
Gradle plugin for automating the download process of localization files.
Stars: ✭ 19 (-92.94%)
Mutual labels:  gradle, gradle-plugin
Maven Git Versioning Extension
This extension will virtually set project versions, based on current git branch or tag.
Stars: ✭ 178 (-33.83%)
Mutual labels:  gradle, gradle-plugin
gradle-helm-plugin
A Gradle plugin for building, publishing and managing Helm charts.
Stars: ✭ 42 (-84.39%)
Mutual labels:  gradle, gradle-plugin
Versioning
Gradle plug-in to generate version information from the SCM branch (Git or Svn)
Stars: ✭ 157 (-41.64%)
Mutual labels:  gradle, gradle-plugin
Click Debounce
Using ASM to handle Android's click debounce, specially a quick double click.
Stars: ✭ 175 (-34.94%)
Mutual labels:  gradle, gradle-plugin
RocketXPlugin
🔥🔥 android 端编译加速插件🚀 自动识别未改动 module 并在编译流程中替换为 aar ,只编译改动模块,加速 Android apk 的编译速度。
Stars: ✭ 408 (+51.67%)
Mutual labels:  gradle, gradle-plugin
gradle-console-reporter
Gradle plugin to report various kinds of summaries to console.
Stars: ✭ 49 (-81.78%)
Mutual labels:  gradle, gradle-plugin

Gradle AWS Plugin

Join the chat at https://gitter.im/gradle-aws-plugin/Lobby

Gradle plugin to manage AWS resources.

Current Features / Supported AWS Products

  • S3
    • Create bucket
    • Delete bucket
    • Upload object(s)
    • Delete object(s)
    • File sync
    • Set bucket policy
    • Set website configuration
  • EC2
    • Run instance
    • Start instance
    • Stop instance
    • Terminate instance
    • Import key
    • Create security group
    • Delete security group
    • Authorize security group ingress permissions
    • Authorize security group egress permissions
    • Revoke security group ingress permissions
    • Revoke security group egress permissions
    • Wait for specific status on instance
  • RDS
    • Create DB instance
    • Delete DB instance
    • Modify DB instance
    • Migrate (create or modify) DB instance
    • Reboot DB instance
    • Wait for specific status on DB instance
  • Route53
    • Create hosted zone
    • Delete hosted zone
    • Change record set
  • Elastic Beanstalk
    • Create or delete applications
    • Create or terminate environments
    • Create or delete configuration templates
    • Create or delete application versions
    • Wait for specific status on environment
  • CloudFormation
    • Migrate (create or update) stack
    • Delete stack
    • Wait for specific status on stack
  • Lambda
    • Create function
    • Update function code
    • Update function configuration
    • Migrate (create or update) function
    • Invoke function
    • Delete function
    • Publish function version
    • Create alias
    • Update alias
  • IAM
    • Create role
    • Attach role policy
  • ELB
    • (TBD)
  • SQS
    • Send messages
    • Delete messages
    • Read messages
  • SNS
    • Publish message
  • SSM
    • Put parameters

Requirements

  • Java 8+
  • Gradle 2.4+

Usage

Add this to your build.gradle:

buildscript {
  repositories {
    mavenCentral()
    maven { url "https://plugins.gradle.org/m2/" }
  }
  dependencies {
    classpath "jp.classmethod.aws:gradle-aws-plugin:0.30"
  }
}

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.

S3 Create bucket

apply plugin: 'jp.classmethod.aws.s3'

task createBucket(type: CreateBucketTask) {
	bucketName myBucketName

	// one of http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region values, us-east-1 by default
	region regionName
	// create bucket only if it does not exist, otherwise skip
	ifNotExists true
}

Look at S3 example 1 for more information.

S3 files tasks

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 at S3 example 1 and S3 example 2 for more information.

EC2 instance tasks

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 at EC2 example for more information.

RDS DB instance tasks

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 at RDS example for more information.

Route 53 hosted zone tasks

apply plugin: 'jp.classmethod.aws.route53'

task 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 at Route 53 example for more information.

Elastic Beanstalk environment tasks

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 environment'
    templateName = 'development'
    versionLabel = "foobar-${project.war.version}-${timestamp}"
  }
}

// task awsEbMigrateEnvironment, awsEbDeleteApplication and so on are declared

Look Elastic Beanstalk example for more information.

CloudFormation stack tasks

apply plugin: 'jp.classmethod.aws.cloudformation'

cloudFormation {
  stackName 'foobar-stack'
  stackParams([
    Foo: 'bar',
    Baz: 'qux'
  ])
  stackTags([
    Bar: 'foo',
    Baz: 'fox'
  })
  capabilityIam true
  templateFile project.file("foobar.template")
  templateBucket 'example-bucket'
  templateKeyPrefix 'foobar/'
}

// awsCfnMigrateStack and awsCfnDeleteStack task (and so on) are declared.

Look at CloudFormation example for more information.

Lambda function tasks

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"
	alias = 'DEV'
	environment = [
	    p1: "Value",
	    p2: "Value2"
	]
	tags = [
	    p1: "Value",
	    p2: "Value2"    
	]
}

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"
}

task publishVersionFunction(type: AWSLambdaPublishVersionTask, dependsOn: migrateFunction) {
	functionName = "foobar"
}

task createAlias(type: AWSLambdaCreateAliasTask, dependsOn: publishVersionFunction) {
	functionName = "foobar"
	aliasName = "alias"
	functionVersion = "1"
}

task updateAlias(type: AWSLambdaUpdateAliasTask, dependsOn: createAlias) {
	functionName = "foobar"
    aliasName = "alias"
	functionVersion = "1"
    routingConfig {
        additionalVersionWeight = 0.7
		useNextVersion = true
    }
}

task updateLambdaFunctionCode(type: AWSLambdaUpdateFunctionCodeTask) {
    functionName = "fooBar"
    zipFile = zip.archivePath
}

Look at Lambda example for more information.

SQS tasks

apply plugin: "jp.classmethod.aws.sqs"

task sendMessages(type: AmazonSQSSendMessagesTask) {
	queueName 'gradle-aws-plugin-sample'
	messages Stream.of("Test 1", "Test 2")
}

task deleteMessages(type: AmazonSQSMessageConsumerTask) {
	queueName 'gradle-aws-plugin-sample'
	showMessages false
}

task viewMessages(type: AmazonSQSMessageConsumerTask) {
	queueName 'gradle-aws-plugin-sample'
	deleteMessages false
	maxNumberOfMessages 50
}

Look at SQS example for more information.

SNS tasks

apply plugin: "jp.classmethod.aws.sns"

task publishMessage(type: AmazonSNSPublishMessageTask) {
	topicArn 'arn:aws:sns:us-east-1:000000000000:gradle-aws-plugin-sns-topic'
	message 'Test body'
	subject 'Optional test subject'
}

task publishJsonMessage(type: AmazonSNSPublishMessageTask) {
	topicArn 'arn:aws:sns:us-east-1:000000000000:gradle-aws-plugin-sns-topic'
	message JsonOutput.toJson(['default': 'Default message body.',
							   'email'  : 'Email message body.',
							   'sms': 'SMS message body.'])
	messageStructure 'json'
}

Look at SNS example for more information.

License

Copyright (C) 2013-2018 Classmethod, Inc.

Distributed under the Apache License v2.0. See the file copyright/LICENSE.txt.

Development and Contribution

We are open to 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].