@infamousjoeg infamousjoeg released this Sep 8, 2018 · 23 commits to master since this release

Assets 4

You can use the exported AWS SAM template AWSEC2CloudflareLambda.yaml to orchestrate setting up your AWS Lambda function using the same Python script. Just don't forget to populate values into your Environment Variables before enabling the CloudWatch Event trigger!

  1. Install Python and pip.
    sudo apt install python python-pip -y or sudo yum install python python-pip -y
    You deal with the epel-release repo enablement on your own if you're on RHEL or CentOS.
  2. Install AWS CLI.
    pip install awscli
  3. Install AWS SAM CLI.
    pip install aws-sam-cli
  4. aws s3 mb s3://<bucket name> --region <region>
    <bucket name> = cdemoUpdateCloudflare
    <region> = us-east-1 or us-central-1
  5. Upload SAM Package to AWS S3 Bucket created in Step 3. This will output a CloudFormation Template for us to use based on the package uploaded.
    sam package --template-file AWSEC2CloudflareLambda.yaml --output-template-file AWSEC2CloudflareLambda-output.yaml --s3-bucket <bucket name>
  6. Deploy SAM template-based generated CloudFormation template in CloudFormation.
    sam deploy --template-file AWSEC2CloudflareLambda-output.yaml --stack-name <CloudFormation Stack Name>

How to Deploy SAM Template

CloudFormation Success Screenshot

Lambda Function Created Automatically