- Access to AWS Account with permission to create IAM role, DynamoDB, 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 below command to make sure you're in the correct AWS account and configured.
aws configure
For additional help on configuring, please see https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
Navigate up two directories to /serverless
. Run the following command to create an S3 bucket.
- Replace
<my-bucket-name>
with your bucket name. - Replace
<my-region>
with your region name.
aws s3api create-bucket --bucket <my-bucket-name> --region <my-region> \
--create-bucket-configuration LocationConstraint=<my-region>
sam package \
--template-file template.yaml \
--output-template-file packaged.yaml \
--s3-bucket <my-bucket-name>
DO NOT run the output from above command, and proceed to the next step.
Replace <my-stack-name>
with your stack name.
sam deploy \
--template-file packaged.yaml \
--stack-name <my-stack-name> \
--capabilities CAPABILITY_IAM
On completion, copy the value of ApiURL
as you will need it later for your client.
ApiURL example: https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/Prod/
If you need to retrieve the CloudFormation stack outputs again, run the following command:
aws cloudformation describe-stacks \
--stack-name <my-stack-name> --query 'Stacks[].Outputs'
Run the following command to create an Amazon IVS Channel for testing. You can skip this step if you already have one or more channels in your account.
Replace <my-channel-name>
with a channel name.
aws ivs create-channel --name <my-channel-name>
Go to the web-ui directory for instructions on running the client application.
- 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>
- Delete Demo Channel
aws ivs delete-channel --name my-channel
Endpoint: <ApiURL>
Method: POST
Content Type: JSON
Payload:
{
"Channel": "My-Channel",
"Title": "My-Title",
"Metadata": "My-Metadata"
}
Response Code: 200
Response Body:
{}
Endpoint: <ApiURL>
Method: PUT
Content Type: JSON
Payload:
{
"Id": "Record-Id",
"Channel": "My-Channel",
"Title": "My-Title",
"Metadata": "My-Metadata"
}
Response Code: 200
Response Body:
{
"Id": "Record-Id",
"Channel": "My-Channel",
"Title": "My-Title",
"Metadata": "{...}",
"Sent": "Yes/No"
}
Endpoint: <ApiURL>send
Method: PUT
Content Type: JSON
Payload:
{
"Id": "Record-Id",
"Channel": "My-Channel",
"Title": "My-Title",
"Metadata": "My-Metadata"
}
Response Code: 200
Response Body:
{}
Endpoint: <ApiURL>
Method: GET
Content Type: JSON
Response Code: 200
Response Body:
[
{
"Id": "Record-Id",
"Channel": "My-Channel",
"Title": "My-Title",
"Metadata": "My-Metadata"
},
...
]
Endpoint: <ApiURL>/channels
Method: GET
Content Type: JSON
Response Code: 200
Response Body:
[
{
"arn": "Channel-Arn",
"name": "My-Channel",
"latencyMode": "LOW",
"tags": {...}
},
...
]
Endpoint: <ApiURL>?id=xxxxxxxxxxxxxx
Method: GET
Content Type: JSON
Response: 200
Response Body:
[
{
"Id": "Record-Id",
"Channel": "My-Channel",
"Title": "My-Title",
"Metadata": "{...}",
"Sent": "Yes/No"
}
]
Endpoint: <ApiURL>?id=xxxxxxxxxxxxxx
Method: DELETE
Content Type: JSON
Response: 200
Response Body:
{}