apiVersion: apps/v1 kind: Deployment metadata: name: demo-app # the name of the deployment spec: replicas: 1 # tells deployment to run 1 pods matching the template selector: matchLabels: name: demo-app template: # create pods using pod definition in this template metadata: labels: name: demo-app spec: containers: - name: demo-app image: # this is the your demo app docker image imagePullPolicy: Always - name: cloudwatch-agent image: public.ecr.aws/cloudwatch-agent/cloudwatch-agent:latest imagePullPolicy: Always env: - name: POD_NAME valueFrom: fieldRef: fieldPath: metadata.name resources: limits: cpu: 100m memory: 100Mi requests: cpu: 32m memory: 24Mi volumeMounts: - name: cwagentconfig mountPath: /etc/cwagentconfig volumes: - name: cwagentconfig configMap: name: cwagentconfig-sidecar --- # create configmap for cwagent sidecar config apiVersion: v1 data: # Configuration is in Json format. No matter what configure change you make, # please keep the Json blob valid. cwagentconfig.json: | { "logs": { "metrics_collected": { "emf": {} } } } kind: ConfigMap metadata: name: cwagentconfig-sidecar