# AWS Serverless, CloudFormation : Error, Trying to populate non string value into a string for variable

**URL:** <https://forum.serverless.com/t/aws-serverless-cloudformation-error-trying-to-populate-non-string-value-into-a-string-for-variable/9915>\
**Category:** Serverless Framework\
**Tags:** cloudformation\
**Created:** [November 19, 2019, 12:19pm UTC](https://forum.serverless.com/t/aws-serverless-cloudformation-error-trying-to-populate-non-string-value-into-a-string-for-variable/9915 "2019-11-19T12:19:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dattatrayhkulkarni](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dattatrayhkulkarni](https://forum.serverless.com/u/dattatrayhkulkarni)\
**Post date:** [November 19, 2019, 12:19pm UTC](https://forum.serverless.com/t/aws-serverless-cloudformation-error-trying-to-populate-non-string-value-into-a-string-for-variable/9915/1 "2019-11-19T12:19:02Z")

</div>

I am using serverless framework for deploying my application on AWS Cloud.

```auto
https://serverless.com/

```

I want to use the value of AWS Account ID in my serverless.yml file and I want to export the acccount ID as the environment variable, so that it can be accessed from Lambda functions.

Based on the value of this lambda function, I want to create some resources ( like IAM roles, etc.), which refer to this accountId variable.

But when I try to deploy the stack, I get the below error,

> Trying to populate non string value into a string for variable ${self:custom.accountId}. Please make sure the value of the property is a string.

My Serverless.yml file is as below

```auto
custom:
  accountId : !Ref "AWS::AccountId"

provider:
  name: aws
  runtime: go1.x
  stage: dev

  region: us-east-1

  environment:
     ACCOUNT_ID : ${self:custom.accountId}       
     myRoleArn: arn:aws:iam::${self:custom.accountId}:role/xxxxxxxx

```

Is there any way to refer to the value of the Account Id in the serverless.yml file?
