Create AWS Media Elements by Amplify Elemental Plugin
When we using aws-amplify to manage your application, you can add AWS Media Elementals by amplify-elemental-pl […]
広告ここから
広告ここまで
目次
When we using aws-amplify to manage your application, you can add AWS Media Elementals by amplify-elemental-plugin
more easily.
Installation
$ npm install -g @aws-amplify/cli
$ npm install amplify-elemental-plugin -g
Initialize your project by AWS Amplify
Create React project, and initialize amplify project by amplify-cli.
When you amplify init
create-react-app
$ npx create-react-app element
$ cd element
$ amplify init
Note: It is recommended to run this command from the root of your app directory
? Choose your default editor: (Use arrow keys)
? Choose your default editor: Visual Studio Code
? Choose the type of app that you're building javascript
Please tell us about your project
? What javascript framework are you using react
? Source Directory Path: src
? Distribution Directory Path: build
? Build Command: npm run-script build
? Start Command: npm run-script start
Using default provider awscloudformation
For more information on AWS Profiles, see:
https://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html
? Do you want to use an AWS profile? Yes
? Please choose the profile you want to use default
After configure the project, the CLI will launch a CloudFormation template.
⠴ Initializing project in the cloud...
CREATE_IN_PROGRESS UnauthRole AWS::IAM::Role Mon Nov 26 2018 14:24:44 GMT-0800 (PST)
CREATE_IN_PROGRESS DeploymentBucket AWS::S3::Bucket Mon Nov 26 2018 14:24:44 GMT-0800 (PST)
CREATE_IN_PROGRESS UnauthRole AWS::IAM::Role Mon Nov 26 2018 14:24:45 GMT-0800 (PST) Resource creation Initiated
CREATE_IN_PROGRESS DeploymentBucket AWS::S3::Bucket Mon Nov 26 2018 14:24:45 GMT-0800 (PST) Resource creation Initiated
⠦ Initializing project in the cloud...
CREATE_IN_PROGRESS AuthRole AWS::IAM::Role Mon Nov 26 2018 14:24:53 GMT-0800 (PST)
CREATE_IN_PROGRESS AuthRole AWS::IAM::Role Mon Nov 26 2018 14:24:56 GMT-0800 (PST) Resource creation Initiated
CREATE_COMPLETE UnauthRole AWS::IAM::Role Mon Nov 26 2018 14:24:56 GMT-0800 (PST)
⠼ Initializing project in the cloud...
CREATE_COMPLETE DeploymentBucket AWS::S3::Bucket Mon Nov 26 2018 14:25:06 GMT-0800 (PST)
⠸ Initializing project in the cloud...
CREATE_COMPLETE AuthRole AWS::IAM::Role Mon Nov 26 2018 14:25:21 GMT-0800 (PST)
CREATE_COMPLETE dminanel-20181126142440 AWS::CloudFormation::Stack Mon Nov 26 2018 14:25:24 GMT-0800 (PST)
✔ Successfully created initial AWS cloud resources for deployments.
Your project has been successfully initialized and connected to the cloud!
Some next steps:
"amplify status" will show you what you've added already and if it's locally configured or deployed
"amplify <category> add" will allow you to add features like user login or a backend API
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
Pro tip:
Try "amplify add api" to create a backend API and then "amplify publish" to deploy everything
Add Elemental components by CLI
$ amplify livestream add
? Provide a friendly name for your resource to be used as a label for this category in the project: (AdminPanel)
? Provide a friendly name for your resource to be used as a label for this category in the project: AdminPanel
? GOP Size: 1
? GOP(s) Per Segment: 2
? Segment(s) Per Playlist: 3
? Input Security Group: 0.0.0.0/0
? MediaLive ingest type: RTMP_PUSH
? Encoding Profile: SD (single 432p)
? Auto Start: Yes
? Where do you want to stream to? MediaStore
You can check the status by amplify status
command.
$ amplify status
(node:31469) ExperimentalWarning: The fs.promises API is experimental
| Category | Resource name | Operation | Provider plugin |
| --------- | ------------- | --------- | ----------------- |
| Elemental | AdminPanel | Create | awscloudformation |
And you can push the update by amplify push
.
$ amplify push
| Category | Resource name | Operation | Provider plugin |
| --------- | ------------- | --------- | ----------------- |
| Elemental | AdminPanel | Create | awscloudformation |
? Are you sure you want to continue? true
⠴ Updating resources in the cloud. This may take a few minutes...
UPDATE_IN_PROGRESS dminanel-20181126142440 AWS::CloudFormation::Stack Mon Nov 26 2018 14:28:21 GMT-0800 (PST) User Initiated
CREATE_IN_PROGRESS ElementalAdminPanel AWS::CloudFormation::Stack Mon Nov 26 2018 14:28:26 GMT-0800 (PST)
CREATE_IN_PROGRESS ElementalAdminPanel AWS::CloudFormation::Stack Mon Nov 26 2018 14:28:27 GMT-0800 (PST) Resource creation Initiated
⠋ Updating resources in the cloud. This may take a few minutes...
CREATE_IN_PROGRESS dminanel-20181126142440-ElementalAdminPanel-2AMLTOLJQG66 AWS::CloudFormation::Stack Mon Nov 26 2018 14:28:26 GMT-0800 (PST) User Initiated
CREATE_IN_PROGRESS rMS AWS::CloudFormation::Stack Mon Nov 26 2018 14:28:30 GMT-0800 (PST)
CREATE_IN_PROGRESS rMS AWS::CloudFormation::Stack Mon Nov 26 2018 14:28:31 GMT-0800 (PST) Resource creation Initiated
⠹ Updating resources in the cloud. This may take a few minutes...
CREATE_COMPLETE rMS AWS::CloudFormation::Stack Mon Nov 26 2018 14:30:26 GMT-0800 (PST)
CREATE_IN_PROGRESS rML AWS::CloudFormation::Stack Mon Nov 26 2018 14:30:28 GMT-0800 (PST)
CREATE_IN_PROGRESS rML AWS::CloudFormation::Stack Mon Nov 26 2018 14:30:29 GMT-0800 (PST) Resource creation Initiated
⠹ Updating resources in the cloud. This may take a few minutes...
CREATE_COMPLETE rML AWS::CloudFormation::Stack Mon Nov 26 2018 14:32:05 GMT-0800 (PST)
CREATE_COMPLETE dminanel-20181126142440-ElementalAdminPanel-2AMLTOLJQG66 AWS::CloudFormation::Stack Mon Nov 26 2018 14:32:07 GMT-0800 (PST)
⠹ Updating resources in the cloud. This may take a few minutes...
CREATE_COMPLETE ElementalAdminPanel AWS::CloudFormation::Stack Mon Nov 26 2018 14:32:31 GMT-0800 (PST)
⠼ Updating resources in the cloud. This may take a few minutes...
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS dminanel-20181126142440 AWS::CloudFormation::Stack Mon Nov 26 2018 14:32:34 GMT-0800 (PST)
UPDATE_COMPLETE dminanel-20181126142440 AWS::CloudFormation::Stack Mon Nov 26 2018 14:32:34 GMT-0800 (PST)
✔ All resources are updated in the cloud
Get resource information
After push the update, you can get the resource information by amplify livestream get-info
command.
$ amplify livestream get-info
? Choose what project you want to get info for? (Use arrow keys)
? Choose what project you want to get info for? AdminPanel
MediaLive
MediaLive Primary Ingest Url: rtmp://99.99.999.999:1935/AdminPanel-p
MediaLive Primary Stream Key: AdminPanel-p
MediaLive Backup Ingest Url: rtmp://99.99.999.999:1935/AdminPanel-b
MediaLive Backup Stream Key: AdminPanel-b
MediaStore
MediaStore Output Url: https://xxxxxxxxxxxx.data.mediastore.us-east-1.amazonaws.com/p/index.m3u8