# customer kms key assign to volume

**URL:** <https://forum.ansible.com/t/customer-kms-key-assign-to-volume/35021>\
**Category:** Ansible Project\
**Created:** [April 21, 2021, 8:24am UTC](https://forum.ansible.com/t/customer-kms-key-assign-to-volume/35021 "2021-04-21T08:24:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jayesh\_Mahajan](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@Jayesh\_Mahajan](https://forum.ansible.com/u/Jayesh_Mahajan)\
**Post date:** [April 21, 2021, 8:24am UTC](https://forum.ansible.com/t/customer-kms-key-assign-to-volume/35021/1 "2021-04-21T08:24:31Z")

</div>

Dear Tean,

I want to encrypt my EBS volume with KMS for that I used the below task.

- ec2\_lc:  
name: “{{ childtenantname }}-iqb-{{ ami\_name }}-{{ ansible\_date\_time.epoch }}”  
image\_id: “{{ ami\_facts.images[0].image\_id }}”  
key\_name: “{{ envrn }}-{{ region }}-eks”  
security\_groups: “{{ envrn }}-iqbot”  
instance\_type: “{{ instance\_type }}”  
region: “{{ region }}”  
user\_data: “{{ lookup(‘template’, ‘./roles/templates/user\_data.ps1’) }}”  
instance\_profile\_name: “{{ envrn }}-{{ region }}-iqbot-profile”  
state: present  
instance\_monitoring: true  
volumes:
- device\_name: /dev/sda1  
volume\_size: 512  
volume\_type: gp2  
delete\_on\_termination: true  
encrypted: true

kms\_key\_id: “{{ iqbot\_ebs\_key["keys"][0]["key\_id"] }}”
