-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(amplify): Add resource support (wip) #3209
Changes from all commits
fca16f4
4604403
f5dac6f
c7bc778
e2244bb
8106650
a519b63
d87f93c
7a8958d
2a2fc85
b8939d0
bac81b0
7d9e241
f91ba93
df7587b
d3a001f
d004a4a
8455f35
01b46e6
5d573ed
42ddf95
f2a232d
b9a038f
e8031ed
693ec41
4db73bf
bdbbac4
6b69aba
8f07595
a239a8f
d804ae9
ad1d730
5995e0b
c149f0d
377504e
71d91a6
3d449ef
bf1d97b
c1e845a
e6d3c57
8129713
de24948
2dcd1ab
f2675b1
88487b7
2c03876
d30f298
5cfd540
876a3a3
bff9cfb
9ebd209
0884725
a84e247
4abfb0b
8c7ea38
5f44d4d
13f7091
80fe39f
4a9871a
49fca18
d583247
4d8c685
844ca59
39c8a0a
9b6adaa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
## AWS Amplify Construct Library | ||
|
||
The AWS Amplify Console provides a Git-based workflow for deploying and hosting fullstack serverless web applications. A fullstack serverless app consists of a backend built with cloud resources such as GraphQL or REST APIs, file and data storage, and a frontend built with single page application frameworks such as React, Angular, Vue, or Gatsby. | ||
|
||
Fullstack serverless web applications functionality is often spread across frontend code running in the browser and backend business logic running in the cloud. This makes application deployment complex and time consuming as you need to carefully coordinate release cycles to ensure your frontend and backend are compatible, and new features do not break your production customers. | ||
|
||
The Amplify Console accelerates your application release cycle by providing a simple workflow for deploying full-stack serverless applications. You just connect your application's code repository to Amplify Console, and changes to your frontend and backend are deployed in a single workflow on every code commit. | ||
|
||
<!--BEGIN STABILITY BANNER--> | ||
|
||
--- | ||
|
@@ -15,8 +22,129 @@ | |
--- | ||
<!--END STABILITY BANNER--> | ||
|
||
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. | ||
## Create a Todo App | ||
Using the sample application from VueJS (https://github.com/vuejs/vue/tree/dev/examples/todomvc), you can deploy a Todo app that uses VueJS. | ||
|
||
The example will create an Amplify app that contains a BuildSpec and some custom rules to ensure files are able to be loaded correctly when the page is requested. It will also add domain pointing to the master branch. | ||
|
||
|
||
```ts | ||
const app = new amplify.App(stack, 'TodoApp', { | ||
name: 'TodoApp', | ||
repository: 'https://github.com/vuejs/vue', | ||
description: 'TodoApp Example from VueJS', | ||
oauthToken: new cdk.Secret('sometoken'), | ||
buildSpec: codebuild.BuildSpec.fromObject({ | ||
version: 0.2, | ||
frontend: { | ||
phases: { | ||
build: { | ||
commands: [ | ||
'npm i' | ||
'npm run build', | ||
'cp dist/vue.min.js examples/todomvc/' | ||
] | ||
} | ||
}, | ||
artifacts: { | ||
baseDirectory: 'examples/todomvc/', | ||
files: [ | ||
'*' | ||
] | ||
} | ||
} | ||
}) | ||
}); | ||
|
||
app.addCustomRule('/dist/vue.min.js', '/vue.min.js', '200'); | ||
app.addBranch('TodoMaster', { | ||
branchName: 'master', | ||
description: 'master branch' | ||
}); | ||
|
||
app.addDomain('TodoDomain', { | ||
domainName: 'example.com', | ||
subdomainSettings: [{ | ||
branchName: 'master', | ||
prefix: '/' | ||
}] | ||
}) | ||
``` | ||
|
||
## Add an App | ||
Define a new App: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain what an amplify app is. assume throughout this doc that people don't need to open 100 browser tabs to understand what they need to do. This should be as self-contained as possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An Amplify App is a collection of branches that represent frontend and backend environments. |
||
```ts | ||
new amplify.App(stack, 'MyApp', { | ||
name: 'MyApp', | ||
repository: 'https://github.com/aws/aws-cdk' | ||
}); | ||
``` | ||
`App` constructs expose the following deploy-time attributes: | ||
- `appId` - Unique Id for the Amplify App (i.e. `dbhvlzrug0n3u`) | ||
- `appName` - Name for the Amplify App (i.e. `MyApp`) | ||
- `appArn` - ARN for the Amplify App (i.e. `arn:aws:amplify:eu-west-1:1234567890123:apps/dbhvlzrug0n3u`) | ||
- `appDefaultDomain` - Default domain for the Amplify App (i.e. `dbhvlzrug0n3u.amplifyapp.com`) | ||
|
||
### Add Domain | ||
```ts | ||
const app = new amplify.App(stack, 'MyApp', { | ||
name: 'MyApp', | ||
repository: 'https://github.com/aws/aws-cdk' | ||
}); | ||
|
||
app.addDomain('MyDomain', { | ||
domainName: 'example.com', | ||
subdomainSettings: [{ | ||
branchName: 'master', | ||
prefix: '/' | ||
}] | ||
}); | ||
``` | ||
|
||
### Add Branch | ||
```ts | ||
const app = new amplify.App(stack, 'MyApp', { | ||
name: 'MyApp', | ||
repository: 'https://github.com/aws/aws-cdk' | ||
}); | ||
|
||
app.addBranch('MyBranch', { | ||
branchName: 'master' | ||
}); | ||
``` | ||
|
||
## Domain | ||
To add a domain to an existing app: | ||
```ts | ||
import amplify = require('@aws-cdk/aws-amplify'); | ||
const app = amplify.App.fromAppId(stack, 'MyApp', 'dbhvlzrug0n3u'); | ||
|
||
app.addDomain('MyDomain', { | ||
domainName: 'example.com', | ||
subdomainSettings: [{ | ||
branchName: 'master', | ||
prefix: '/' | ||
}] | ||
}) | ||
``` | ||
|
||
The `Domain` construct exposes the following deploy-time attributes: | ||
- `arn` - ARN for the Domain Association (i.e. `arn:aws:amplify:eu-west-1:12345678901234:apps/dbhvlzrug0n3u/domains/example.com`) | ||
- `certificateRecord` - DNS Record for certificate verification (i.e. `_ed2e4e47958904855e7e12a2714c9d38.example.com. CNAME _d92413da499c5d5bd55611aeb2652633.duyqrilejt.acm-validations.aws.`) | ||
- `domainName` - Name of the domain (i.e. `example.com`) | ||
- `domainStatus` - Status fo the Domain Association (i.e. `AVAILABLE`) | ||
- `statusReason` - Reason for the current status of the domain | ||
|
||
|
||
## Branch | ||
To add a branch to an existing app: | ||
```ts | ||
const app = amplify.App.fromAppId(stack, 'MyApp', 'dbhvlzrug0n3u'); | ||
|
||
app.addBranch('MyBranch', { | ||
branchName: 'master' | ||
}) | ||
``` | ||
|
||
`Branch` constructs expose the following deploy-time attributes: | ||
- `branchArn` - ARN for a branch, part of an Amplify App. (i.e. `arn:aws:amplify:eu-west-1:12345678901234:apps/dbhvlzrug0n3u/branches/master`) | ||
- `branchName` - Name for a branch, part of an Amplify App. (i.e. `master`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide some background about what is the Amplify service and what is this library capable of doing. As much as possible copy details and links from AWS documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Amplify service (known as the Amplify Console) offers continuous deployment and fully managed hosting for fullstack serverless web apps.