- Access to an AWS Account with permissions to create: IAM role, DynamoDB, Cognito, Lambda, API Gateway, S3, and Cloudformation.
- AWS CLI Version 2
- AWS SAM CLI
- AWS-SDK-JS version 2.714.0 or greater for IVS support
Before you start, run the following command to make sure the AWS CLI tool is configured correctly.
aws configure
For configuration help, see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
- Replace
<my-bucket-name>
with your bucket name. - Replace
<my-region>
with your region name (for ex.us-west-2
).
aws s3api create-bucket --bucket <my-bucket-name> --region <my-region> \
--create-bucket-configuration LocationConstraint=<my-region>
- Install NodeJS. Download latest LTS version ("Recommended for Most Users")
- Navigate to the serverless dependencies directory
serverless/dependencies/nodejs
on your local computer. Example:~/Developer/amazon-vs-ugc-web-demo/serverless/dependencies/nodejs
- Run:
npm install
- Compress the serverless dependencies directory
serverless/dependencies/nodejs
into a.zip
file namednodejs.zip
. - Upload the zipped dependencies to the previously created S3 bucket"
aws s3 cp ./dependencies/nodejs.zip s3://<my-bucket-name>/
sam package \
--template-file template.yaml \
--output-template-file packaged.yaml \
--s3-bucket <my-bucket-name>
DO NOT run the output from above command. Instead, proceed to next step.
Replace <my-stack-name>
with your stack name.
sam deploy \
--template-file packaged.yaml \
--stack-name <my-stack-name> \
--capabilities CAPABILITY_IAM \
--parameter-overrides DependenciesBucket=<my-bucket-name>
On completion, copy the value of ApiURL
. Paste this value on line 8 of /web-ui/src/config.js
:
// config.js
...
export const UGC_API = ""; // paste the ApiURL value here
...
Example of ApiURL: https://xxxxxxxxxx.execute-api.{my-region}.amazonaws.com/Prod/
To retrieve Cloudformation stack outputs again, run the following command:
aws cloudformation describe-stacks \
--stack-name <my-stack-name> --query 'Stacks[].Outputs'
Follow the steps in the web-ui README to get the UI running.
Endpoint: <ApiURL>signUp
Method: POST
Content Type: JSON
Payload:
{
"email": "My-Channel",
"password": "My-Title",
"avatar": "My-Avatar",
"bgColor": "My-Background-Color",
"channelLatencyMode": "My-Channel-Latency-Mode", // Optional - default to NORMAL
"channelType": "My-Channel-Type, // Optional - default to BASIC
}
Endpoint: <ApiURL>auth
Method: POST
Content Type: JSON
Payload:
{
"email": "My-Channel",
"password": "My-Title"
}
Endpoint: <ApiURL>user/username?access_token=<my_access_token>
Method: GET
Content Type: JSON
{
"username": "username",
"avatar": "avatar",
"bgColor": "color",
}
Endpoint: <ApiURL>user/attr?access_token=<my_access_token>
Method: POST
Content Type: JSON
Payload:
{
"Name": "picture",
"Value": "My-New-Picture"
}
Endpoint: <ApiURL>user/changePassword?access_token=<my_access_token>
Method: POST
Content Type: JSON
Payload:
{
"oldPassword": "My-Old-Password",
"newPassword": "My-New-Password"
}
Endpoint: <ApiURL>user/delete?access_token=<my_access_token>
Method: GET
Content Type: JSON
Endpoint: <ApiURL>stream?access_token=<my_access_token>
Method: GET
Content Type: JSON
{
"streamKey": "stream-key",
"ingest": "ingest-server"
}
Endpoint: <ApiURL>channels
Method: GET
Content Type: JSON
[
{
"username": "username",
"avatar": "avatar",
"bgColor": "color",
"channelName": "channelName",
"playbackUrl": "playbackUrl",
"isLive": "yes/no",
"startTime": "2022-02-17T22:55:30.000Z" // "0" if offline
},
...
]
Endpoint: <ApiURL>live-channels
Method: GET
Content Type: JSON
[
{
"username": "username",
"avatar": "avatar",
"bgColor": "color",
"channelName": "channelName",
"playbackUrl": "playbackUrl"
},
...
]
Endpoint: <ApiURL>channels/?id=<username>
- Remember to encodeURIComponent
channelArn
Method: GET
Content Type: JSON
Endpoint: <ApiURL>channels/default/streamKey/reset?access_token=<my_access_token>
Method: GET
Content Type: JSON
- Delete Cloudformation stack:
aws cloudformation delete-stack --stack-name <my-stack-name>
- Remove files in S3 bucket
aws s3 rm s3://<my-bucket-name> --recursive
- Delete S3 bucket
aws s3api delete-bucket --bucket <my-bucket-name> --region <my-region>