Skip to content

Commit

Permalink
Merge branch 'staging' into fetch-all-usage-plan-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
echo-bravo-yahoo authored Jun 28, 2019
2 parents 0396f0a + 64e820c commit 02c0274
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 31 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,37 @@ If you have previously set up a v1 developer portal (non-SAM deployed), you will
#### Deploy

Run:

>In the command below, replace the `your-lambda-artifacts-bucket-name` with the name of a bucket that you manage and that already exists. Then, run:
```bash
sam package --template-file ./cloudformation/template.yaml --output-template-file ./cloudformation/packaged.yaml --s3-bucket your-lambda-artifacts-bucket-name
sam package --template-file ./cloudformation/template.yaml \
--output-template-file ./cloudformation/packaged.yaml \
--s3-bucket your-lambda-artifacts-bucket-name
```

Then run:
Then run:

>In the command below, replace the `your-lambda-artifacts-bucket-name` with the name of a bucket that you manage and that already exists, and replace `custom-prefix` with some prefix that is globally unique, like your org name or username. Then, run:
```bash
sam deploy --template-file ./cloudformation/packaged.yaml --stack-name "dev-portal" --s3-bucket your-lambda-artifacts-bucket-name --capabilities CAPABILITY_NAMED_IAM --parameter-overrides DevPortalSiteS3BucketName="custom-prefix-dev-portal-static-assets" ArtifactsS3BucketName="custom-prefix-dev-portal-artifacts" CognitoDomainNameOrPrefix="custom-prefix"
sam deploy --template-file ./cloudformation/packaged.yaml \
--stack-name "dev-portal" \
--s3-bucket your-lambda-artifacts-bucket-name \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
DevPortalSiteS3BucketName="custom-prefix-dev-portal-static-assets" \
ArtifactsS3BucketName="custom-prefix-dev-portal-artifacts" \
CognitoDomainNameOrPrefix="custom-prefix"
```

The command will exit when the stack creation is successful. If you'd like to watch it create in real-time, you can log into the cloudformation console.

To get the URL for the newly created developer portal instance, find the websiteURL field in the cloudformation console's outputs or run this command:

```bash
aws cloudformation describe-stacks --query "Stacks[?StackName=='dev-portal'][Outputs[?OutputKey=='WebsiteURL']][][].OutputValue"
aws cloudformation describe-stacks --query \
"Stacks[?StackName=='dev-portal'][Outputs[?OutputKey=='WebsiteURL']][][].OutputValue"
```

You can override any of the parameters in the template using the `--parameter-overrides key="value"` format. This will be necessary if you intend to deploy several instances of the developer portal or customize some of the features. You can see a full list of overridable parameters in `cloudformation/template.yaml` under the `Parameters` section.
Expand Down
14 changes: 13 additions & 1 deletion cloudformation/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ Parameters:
Type: String
Description: By default, a static asset rebuild doesn't overwrite custom-content. Provide the value `overwrite-content` to replace the custom-content with your local version. Don't do this unless you know what you're doing -- all custom changes in your s3 bucket will be lost.
Default: ''
AllowedValues:
- 'overwrite-content'
- ''
ConstraintDescription: Malformed input - Parameter StaticAssetRebuildMode value must be either 'overwrite-content' or left blank.

MarketplaceSubscriptionTopicProductCode:
Type: String
Expand Down Expand Up @@ -108,11 +112,19 @@ Parameters:
Type: String
Description: Only applicable if creating a custom domain name for your dev portal. Defaults to false, and you'll need to provide your own nameserver hosting. If set to true, a Route53 HostedZone and RecordSet are created for you.
Default: 'false'
AllowedValues:
- 'false'
- 'true'
ConstraintDescription: Malformed input - Parameter UseRoute53Nameservers value must be either 'true' or 'false'

DevelopmentMode:
Type: String
Description: Enabling this weakens security features (OAI, SSL, site S3 bucket with public read ACLs, Cognito callback verification, CORS, etc.) for easier development. Do not enable this in production! Additionally, do not update a stack that was previously in development mode to be a production stack; instead, make a new stack that has never been in development mode.
Description: Enabling this weakens security features (OAI, SSL, site S3 bucket with public read ACLs, Cognito callback verification, CORS, etc.) for easier development. It also breaks frontend routing (except to /index.html), including deep linking and page refresh. Do not enable this in production! Additionally, do not update a stack that was previously in development mode to be a production stack; instead, make a new stack that has never been in development mode.
Default: 'false'
AllowedValues:
- 'false'
- 'true'
ConstraintDescription: Malformed input - Parameter DevelopmentMode value must be either 'true' or 'false'

Conditions:
UseCustomDomainName: !And [!And [!Not [!Equals [!Ref CustomDomainName, '']], !Not [!Equals [!Ref CustomDomainNameAcmCertArn, '']]], !Condition NotDevelopmentMode]
Expand Down
Loading

0 comments on commit 02c0274

Please sign in to comment.