Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. # AWS snippets
  2.  
  3. I created these functions and small scripts to help me a bit using AWS. I personally don't like AWS console (as a guy who uses XTerm and WindowMaker in a regular basis, open a webpage just to check logs is too cumbersome :D). I use Ubuntu 18.04.
  4.  
  5. ## CodeCommit
  6. 1) Creating a pull-request
  7.  
  8. ```bash
  9. aws codecommit create-pull-request \
  10. --title "Doing something with code" \
  11. --description "This PR does amazing things you wouldn't believe." \
  12. --targets "sourceReference=feat/awesome-branch,destinationReference=develop,repositoryName=my-repo"
  13. ```
  14.  
  15. 2) Merging a pull-request
  16.  
  17. ```bash
  18. aws codecommit merge-pull-request-by-three-way --repository-name my-repo --pull-request-id 629
  19. ```
  20.  
  21. ## Reading lambda function last event in CloudWatch
  22.  
  23. ```bash
  24. export GROUP_NAME=/aws/lambda/my-awesome-yet-small-lambda
  25.  
  26. function get_log_id() {
  27. aws logs describe-log-streams --log-group-name ${GROUP_NAME} --order-by LastEventTime |grep logStreamName | sed -E 's/.*: "(.*)",/\1/g'
  28. }
  29.  
  30. aws logs get-log-events --log-group-name ${GROUP_NAME} --log-stream-name "$(get_log_id | tail -n1)" |grep message
  31. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement