I am using CodeBuild to access the Systems Manager Parameter Store. In buildspec.yml, I have the parameter-store configured to access some values in Systems Manager (I certainly have the /mysite/dev/mongodb_uri created in parameter store):

version: 0.2

    MONGO_URI: 'mongodb+srv'
    MONGODB_URI: /mysite/dev/mongodb_uri

      - echo $MONGO_URI
      - echo $MONGODB_URI

Unfortunately, while CodeBuild will echo out the value for key in the variables object, it will not for the parameter-store object:

[Container] 2019/12/24 03:16:09 Running command echo $MONGO_URI 

[Container] 2019/12/24 03:16:09 Running command echo $MONGODB_URI 

It just gives me 3 stars. If I use aws cli, I get the right value:

$ aws ssm get-parameters --names "/mysite/dev/mongodb_uri"
    "Parameters": [
            "Name": "/mysite/dev/mongodb_uri",
            "Type": "String",
            "Value": "mongodb+srv://myuser:[email protected]/test?retryWrites=true&w=majority",
            "Version": 2
    "InvalidParameters": []

My CodeBuild Service Role policies grant me access to Systems Manager:

        "Effect": "Allow",
        "Action": [
        "Resource": [

So why does it give me '***' instead of the actual value when I echo the parameter in buildspec?

1 Answer 1


The "***" is the masking of parameter store output in your log file. The value is available in the environment variable $MONGODB_URI and can be used to pass along to any command or script that needs this value. CodeBuild is merely doing a best-effort masking of log statement which may contain sensitive information.

Also, if you must see the value printed out, you may assign $MONGODB_URI to another variable within your buildspec and print that out.

  • Thanks, I assign it to another variable and still get *** ,-LAST_BUILD_NUMBERR=$LAST_BUILD_NUMBER - echo $LAST_BUILD_NUMBERR
    – alireza
    Oct 1, 2023 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.