{"id":390,"date":"2025-07-03T08:09:18","date_gmt":"2025-07-03T08:09:18","guid":{"rendered":"https:\/\/www.sudeepa.com\/?p=390"},"modified":"2025-07-04T04:56:52","modified_gmt":"2025-07-04T04:56:52","slug":"configuring-gitlab-ci-cd-for-aws-deployment-using-ssh-keys","status":"publish","type":"post","link":"https:\/\/www.sudeepa.com\/?p=390","title":{"rendered":"Configuring GitLab CI\/CD for AWS Deployment Using SSH Keys"},"content":{"rendered":"\n<p style=\"font-size:20px\">Setting Up Secure SSH Connections Between GitLab and AWS<\/p>\n\n\n\n<p>Here&#8217;s a step-by-step guide to configure GitLab CI\/CD pipelines for deploying to AWS EC2 instances using SSH key authentication:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Key Preparation<\/strong><\/h3>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Convert PPK to PEM<\/strong> (using PuttyGen):\n<ul class=\"wp-block-list\">\n<li>Open your existing PPK private key in PuttyGen<\/li>\n\n\n\n<li>Navigate to Conversions \u2192 Export OpenSSH key<\/li>\n\n\n\n<li>Save as a PEM file (e.g., <code>my-key.pem<\/code>)<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Add the PEM file content to GitLab:\n<ul class=\"wp-block-list\">\n<li>Go to your project \u2192 Settings \u2192 CI\/CD \u2192 Variables<\/li>\n\n\n\n<li>Add a new variable:\n<ul class=\"wp-block-list\">\n<li>Key: <code>SSH_PRIVATE_KEY<\/code><\/li>\n\n\n\n<li>Value: Content of your PEM file<\/li>\n\n\n\n<li>Check &#8220;Mask variable&#8221; and &#8220;Protect variable&#8221; options<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Generate public key from pem file and append that to AWS user .ssh\/authorized_keys\n<ul class=\"wp-block-list\">\n<li>Run the following command in your terminal (Linux\/macOS\/WSL)<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">ssh-keygen -y -f \/path\/to\/your-key.pem > \/path\/to\/your-key.pub<\/pre>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting Up Secure SSH Connections Between GitLab and AWS Here&#8217;s a step-by-step guide to configure GitLab CI\/CD pipelines for deploying to AWS EC2 instances using SSH key authentication: 1. Key Preparation ssh-keygen -y -f \/path\/to\/your-key.pem > \/path\/to\/your-key.pub<\/p>\n","protected":false},"author":1,"featured_media":336,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/posts\/390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=390"}],"version-history":[{"count":1,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions"}],"predecessor-version":[{"id":391,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/posts\/390\/revisions\/391"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=\/wp\/v2\/media\/336"}],"wp:attachment":[{"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sudeepa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}