chatwork / sbt-aws   1.0.35

MIT License GitHub

sbt-aws is a plugin for aws

Scala versions: 2.10

DEPRECATED

sbt-aws

Build Status Maven Central Scaladoc Reference Status

The sbt-aws is a sbt's plugin for AWS.

sbt-aws is no longer maintained.
Please consider migration to other tools, suggested below.

Supported Services by sbt-aws's plugins.

Supported sbt versions are 0.13.x and 1.0.x.

Common Usage

You can modify it for you if you can't used configurations on following.

Base Configurations for AWS

// Default AWSCredentialsProviderChain.
credentialsProviderChain in aws := new AWSCredentialsProviderChain(
    new EnvironmentVariableCredentialsProvider(),
    new SystemPropertiesCredentialsProvider(),
    new ProfileCredentialsProvider((credentialProfileName in aws).value.orNull),
    new InstanceProfileCredentialsProvider()
)

// Default AWS creadential profile name in ~/.aws/creadentials
credentialProfileName in aws := None

// Default AWS's Region
region in aws := Regions.AP_NORTHEAST_1

Profile Functions for switching the build settings dynamically

You can switch between the different settings for each environment dynamically using the Profile Functions, if you need it.

// Environment name with the set value of each environment
environmentName in aws := System.getProperty("aws.env", "dev")

// Folder name that you want to store the settings for each environment
configFileFolder in aws := file("env")

// Configuration file for each environment
configFile in aws := {
    val parent = (configFileFolder in aws).value
    parent / ((environmentName in aws).value + ".conf")
}

// Typesafe Config object that represents the configuration file for each environment
config in aws := {
    Option(SisiohConfiguration.parseFile((configFile in aws).value)).getOrElse(SisiohConfiguration.empty)
}

// Typesafe Config object that represents the AWS of configuration files for each environment
awsConfig in aws := {
    (config in aws).value.getConfiguration(aws.key.label).getOrElse(SisiohConfiguration.empty)
}

If you want to use this functions on your build.sbt, Please try as follows.

  • build.sbt
credentialProfileName in aws := {
    getConfigValueOpt(classOf[String], (awsConfig in aws).value, credentialProfileName.key.label)
}
  • env/staging.conf
"aws": {
    "credentialProfileName": "@staging"
}

Execute sbt's command, your configurations will modified dynamically by this functions.

$ sbt -Daws.env=staging aws::aws::CfnStackCreateOrUpdateAndWait