/aws-ec2-mediaconvert

Primary LanguagePythonMIT No AttributionMIT-0

MediaConvert with EC2

This example shows how to set up EC2 instance to create mediaconvert job and CI/CD Pipeline.

Architecture

Prerequisites

  • Make sure you have AWS CLI installed and configured with an aws account you want to use.
  • Ensure you have nodejs installed.
  • Ensure you have direnv installed.

install cdk

npm install

create virtualenv

python3 -m venv .venv
source .venv/bin/activate

install requirements

pip install -r requirements.txt

setting .envrc for direnv

export AWS_PROFILE=<the configuration profile for aws-cli>
export ENDPOINT_URL=<account-specific endpoint for mediaconvert>

To get endpoint url for mediaconvert, run the given python script (utils/emc_endpoint.py)

$ source .venv/bin/activate  # You need to activate virtualenv first, skip this if you did.
$ python utils/emc_endpoint.py

bootstrapping cdk

npx cdk bootstrap --profile <the configuration profile for aws-cli>

deploy

npx cdk deploy EC2Media

Set up CodeCommit

If you run "npx cdk deploy EC2Media", then you will have codecommit repository named "ec2media", You have to push flask source code to the codecommit repository. The flask source code is in ec2media directory. To push the source code to codecommit, you need to set up codecommit to connect it.

Refer to the guideline below

After you set up codecommit, then run this command. You can find in AWS console for CodeCommit. In seoul region, this would be git-codecommit.ap-northeast-2.amazonaws.com/v1/repos/ec2media

$ cd ec2media
$ git init
$ git remote add origin ssh://<codecommit url>
$ git add .
$ git commit -m "initial commit"
$ git push --set-upstream origin master

Check CI/CD Pipeline

After you set up codecommit and push ec2media source code, go to CodePipeline AWS Console. You will see a pipeline is in progress

Test MediaConvert

Open S3 AWS Console, there is S3 bucket which starts with "ec2media-eventnestedstackeve" Create temp and output folder

S3Folder

Upload sample media file to temp folder, output file will be placed to output folder.

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.