CAM - Role Component

Last updated: 2019-12-04 17:21:07

    Tencent-cam-policy

    Easily provision Tencent CAM policy using Serverless Components.
     
     

    1. Install
    2. Create
    3. Configure
    4. Deploy
    5. Remove

     

    1. Install

    $ npm install -g serverless

    2. Create

    Just create a serverless.yml file

    $ touch serverless.yml
    $ touch .env      # your Tencent api keys

    If you don't have a Tencent Cloud account, you could sign up first.

    If you already login in, find TENCENT_SECRET_ID and TENCENT_SECRET_KEY in Tencent Console.

    # .env
    TENCENT_SECRET_ID=123
    TENCENT_SECRET_KEY=123
    TENCENT_APP_ID=123

    3. Configure

    # serverless.yml
    
    myPolicy:
      component: "@serverless/tencent-cam-policy"
      inputs:
        name: my-policy
        description: A policy created by Serverless Components
        policy:
          statement:
            - effect: allow
              action:
                - cos:GetService
              resource: '*'
    

    4. Deploy

    $ sls --debug
    
      DEBUG ─ Resolving the template's static variables.
      DEBUG ─ Collecting components from the template.
      DEBUG ─ Downloading any NPM components found in the template.
      DEBUG ─ Analyzing the template's components dependencies.
      DEBUG ─ Creating the template's components graph.
      DEBUG ─ Syncing template state.
      DEBUG ─ Executing the template's components graph.
    
      myPolicy: 
        id: 27710257
    
      7s › myPolicy › done
    

     

    5. Remove

    $ sls remove --debug
    
      DEBUG ─ Flushing template state and removing all components.
    
      1s › myPolicy › done
    
    

    New to Components?

    Checkout the Serverless Components repo for more information.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help