As per the boto3 docs, the type of the three parameters should not be strings, but bytes. Try reading the cert files from the package as below:
import boto3
client = boto3.client('acm')
def lambda_handler(event, context):
certificate=open('sample.vpn.crt', 'rb').read()
privatekey=open('sample.vpn.key', 'rb').read()
chain=open('ca.crt', 'rb').read()
response = client.import_certificate(
Certificate=certificate,
PrivateKey=privatekey,
CertificateChain=chain
)
Ensure that your certificate files have the format mandated by ACM.
Want to learn more, enroll in our AWS training and also check our this AWS lambda tutorial.