Help Center/
    
      
      Resource Formation Service/
      
      
        
        
        User Guide (ME-Abu Dhabi Region)/
        
        
        Template Reference/
        
        
        Template Introduction/
        
        
        Built-In Functions/
        
      
      base64_encode
    
  
  
    
        Updated on 2022-02-22 GMT+08:00
        
          
          
        
      
      
      
      
      
      
      
      
  
      
      
      
        
base64_encode
The base64_encode function is used to encode character strings in base64 mode.
Syntax
base64_encode: param
Parameter Description
| 
        Parameter  | 
      
        Description  | 
     
|---|---|
| 
        param  | 
      
        Character string to be encoded.  | 
     
Return Value
Base64-encoded result.
Example
tosca_definitions_version: cloud_tosca_version_1_0
inputs:
  ecs_availabilityZone:
    description: AZ to which the ECS belongs
    label: ''
  ecs_flavor:
    description: ECS specifications
    label: ''
  ecs_imageId:
    description: ID of the image used by the ECS
    label: ''
  ecs_nics_0_subnetId:
    description: NIC information about the ECS to be created
    label: ''
  ecs-key:
    description: SSH key pair used for login
    label: ''
  user-name:
    default: test
  password:
    label: ''
  ecs_vpcId:
    description: ID of the VPC to which the ECS belongs
    label: ''
node_templates:
  ecs:
    properties:
      availabilityZone:
        get_input: ecs_availabilityZone
      flavor:
        get_input: ecs_flavor
      imageId:
        get_input: ecs_imageId
      instances: 1
      name: jkhlh
      nics:
        - subnetId:
            get_input: ecs_nics_0_subnetId
      publicIP:
        eip:
          bandwidth:
            shareType: PER
          ipType: 5_bgp
      rootVolume:
        size: 40
        volumeType: SATA
      sshKeyName:
        get_input: ecs-key
      userData:
        base64_encode:
          replace:
            - |
              #!/bin/bash -x
              useradd ${user_name} 
              echo '${user_name}:${user_pwd}' | chpasswd 
            - user_name:
                get_input: user-name
              user_pwd:
                get_input: password
      vpcId:
        get_input: ecs_vpcId
    type: Cloud.ECS.CloudServer
 
   Parent topic: Built-In Functions
  
 Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
                The system is busy. Please try again later.
                
            
        For any further questions, feel free to contact us through the chatbot.
Chatbot