Question: I can trigger my AWS pipeline from jenkins but I don't want to create buildspec.yaml and instead use the pipeline script which already works for jenkins.

Answer: 
In order to user Codebuild you need to provide the Codebuild project with a buildspec.yaml file along with your source code or incorporate the commands into the actual project.

However, I think you are interested in having the creation of the buildspec.yaml file done within the Jenkins pipeline.

Below is a snippet of a stage within a Jenkinsfile, it creates a build spec file for building docker images and then sends the contents of the workspace to a codebuild project. This uses the plugin for Codebuild.

```
stage('Build - Non Prod'){

    String nonProductionBuildSpec = """
version: 0.1

phases:
  pre_build:
    commands:
      - \$(aws ecr get-login --registry-ids <number> --region us-east-1)
  build:
    commands:
      - docker build -t ces-sample-docker .
      - docker tag $NAME:$TAG <account-number>.dkr.ecr.us-east-1.amazonaws.com/$NAME:$TAG
  post_build:
    commands:
      - docker push <account-number>.dkr.ecr.us-east-1.amazonaws.com/$NAME:$TAG
""".replace("\t","    ")
    writeFile file: 'buildspec.yml', text: nonProductionBuildSpec

    //Send checked out files to AWS
    awsCodeBuild projectName: "<codebuild-projectname>",region: "us-east-1", sourceControlType: "jenkins"

}

```

I hope this gives you an idea of whats possible.

Good luck!
Patrick
You will need to write a buildspec for the commands that you want AWS CodeBuild to run. If you use the CodeBuild plugin for Jenkins, you can add that to your Jenkins pipeline and use CodeBuild as a Jenkins build slave to execute the commands in your buildspec.

See more details here: <https://docs.aws.amazon.com/codebuild/latest/userguide/jenkins-plugin.html>