App

class App : KotlinCustomResource

/* /* /* Provides an Amplify App resource, a fullstack serverless app hosted on the AWS Amplify Console.

Note: When you create/update an Amplify App from the provider, you may end up with the error "BadRequestException: You should at least provide one valid token" because of authentication issues. See the section "Repository with Tokens" below.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amplify.App;
import com.pulumi.aws.amplify.AppArgs;
import com.pulumi.aws.amplify.inputs.AppCustomRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new App("example", AppArgs.builder()
.buildSpec("""
version: 0.1
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
""")
.customRules(AppCustomRuleArgs.builder()
.source("/<*>")
.status("404")
.target("/index.html")
.build())
.environmentVariables(Map.of("ENV", "test"))
.repository("https://github.com/example/app")
.build());
}
}

Repository with Tokens

If you create a new Amplify App with the repository argument, you also need to set oauth_token or access_token for authentication. For GitHub, get a personal access token and set access_token as follows:

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amplify.App;
import com.pulumi.aws.amplify.AppArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new App("example", AppArgs.builder()
.accessToken("...")
.repository("https://github.com/example/app")
.build());
}
}

Auto Branch Creation

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amplify.App;
import com.pulumi.aws.amplify.AppArgs;
import com.pulumi.aws.amplify.inputs.AppAutoBranchCreationConfigArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new App("example", AppArgs.builder()
.autoBranchCreationConfig(AppAutoBranchCreationConfigArgs.builder()
.enableAutoBuild(true)
.build())
.autoBranchCreationPatterns(
"*",
"*/**")
.enableAutoBranchCreation(true)
.build());
}
}

Rewrites and Redirects

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amplify.App;
import com.pulumi.aws.amplify.AppArgs;
import com.pulumi.aws.amplify.inputs.AppCustomRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new App("example", AppArgs.builder()
.customRules(
AppCustomRuleArgs.builder()
.source("/api/<*>")
.status("200")
.target("https://api.example.com/api/<*>")
.build(),
AppCustomRuleArgs.builder()
.source("</^[^.]+$|\\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>")
.status("200")
.target("/index.html")
.build())
.build());
}
}

Custom Image

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.amplify.App;
import com.pulumi.aws.amplify.AppArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new App("example", AppArgs.builder()
.environmentVariables(Map.of("_CUSTOM_IMAGE", "node:16"))
.build());
}
}

Import

Amplify App can be imported using Amplify App ID (appId), e.g.,

$ pulumi import aws:amplify/app:App example d2ypk4k47z8u6

App ID can be obtained from App ARN (e.g., arn:aws:amplify:us-east-1:12345678:apps/d2ypk4k47z8u6). */

Properties

Link copied to clipboard
val accessToken: Output<String>?

Personal access token for a third-party source control system for an Amplify app. The personal access token is used to create a webhook and a read-only deploy key. The token is not stored.

Link copied to clipboard
val arn: Output<String>

ARN of the Amplify app.

Link copied to clipboard

Automated branch creation configuration for an Amplify app. An auto_branch_creation_config block is documented below.

Link copied to clipboard

Automated branch creation glob patterns for an Amplify app.

Link copied to clipboard

Credentials for basic authorization for an Amplify app.

Link copied to clipboard
val buildSpec: Output<String>

The build specification (build spec) for an Amplify app.

Link copied to clipboard

Custom rewrite and redirect rules for an Amplify app. A custom_rule block is documented below.

Link copied to clipboard
val defaultDomain: Output<String>

Default domain for the Amplify app.

Link copied to clipboard
val description: Output<String>?

Description for an Amplify app.

Link copied to clipboard

Enables automated branch creation for an Amplify app.

Link copied to clipboard
val enableBasicAuth: Output<Boolean>?

Enables basic authorization for an Amplify app. This will apply to all branches that are part of this app.

Link copied to clipboard

Enables auto-building of branches for the Amplify App.

Link copied to clipboard

Automatically disconnects a branch in the Amplify Console when you delete a branch from your Git repository.

Link copied to clipboard

Environment variables map for an Amplify app.

Link copied to clipboard

AWS Identity and Access Management (IAM) service role for an Amplify app.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

Name for an Amplify app.

Link copied to clipboard
val oauthToken: Output<String>?

OAuth token for a third-party source control system for an Amplify app. The OAuth token is used to create a webhook and a read-only deploy key. The OAuth token is not stored.

Link copied to clipboard
val platform: Output<String>?

Platform or framework for an Amplify app. Valid values: WEB, WEB_COMPUTE. Default value: WEB.

Link copied to clipboard

Describes the information about a production branch for an Amplify app. A production_branch block is documented below.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val repository: Output<String>?

Repository for an Amplify app.

Link copied to clipboard
val tags: Output<Map<String, String>>?

Key-value mapping of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val urn: Output<String>