# Getting handle "accountId" in serverless config

**URL:** https://forum.serverless.com/t/getting-handle-accountid-in-serverless-config/946
**Category:** Serverless Framework
**Tags:** aws
**Created:** [December 14, 2016, 6:19pm UTC](https://forum.serverless.com/t/getting-handle-accountid-in-serverless-config/946 "2016-12-14T18:19:21Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![johncmckim](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/johncmckim/32/27_2.png) [@johncmckim](https://forum.serverless.com/u/johncmckim)
#### Post date: [December 14, 2016, 9:54pm UTC](https://forum.serverless.com/t/getting-handle-accountid-in-serverless-config/946/4 "2016-12-14T21:54:11Z")

</div>

@yankeeinlondon no worries. All part of learning. You won’t be able to use it in that part of the `serverless.yml`.

See this example

```auto
service: foo
provider: # Not CloudFormation
  name: aws
  iamRoleStatements: # You can use CloudFormation here
    ...

functions: # Not CloudFormation
 ....
resources:
  Resources: # This section is CloudFormation
    SomeResource:
       Type: AWS::IAM::Role
       ...
           # something like this to build an ARN
           Resource:
             Fn::Sub: 'aws:ec2:${AWS::Region}:${AWS::AccountId}:xxxxx:xxx/*'

```

If you’re just using the AccountId from IAM you should be able to use it directly rather than through a custom property.

Hope that makes sense. P.S. it’s off the top of my head so there might be syntax issue but should be close 🙂

---

_[View the full topic](https://forum.serverless.com/t/getting-handle-accountid-in-serverless-config/946)._
