{"id":26351904,"url":"https://github.com/martinkindall/aws_spring_cloud_sandbox","last_synced_at":"2026-04-10T02:02:00.192Z","repository":{"id":41965200,"uuid":"465077791","full_name":"martinKindall/aws_spring_cloud_sandbox","owner":"martinKindall","description":"Checking out some aws spring cloud libraries","archived":false,"fork":false,"pushed_at":"2022-04-21T20:44:53.000Z","size":108,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-04T19:40:24.354Z","etag":null,"topics":["aws","codebuild","java11","micrometer","parameter-store","spring-boot","spring-cloud"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinKindall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-01T22:32:30.000Z","updated_at":"2023-01-21T03:07:54.000Z","dependencies_parsed_at":"2022-08-12T00:50:23.332Z","dependency_job_id":null,"html_url":"https://github.com/martinKindall/aws_spring_cloud_sandbox","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinKindall%2Faws_spring_cloud_sandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinKindall%2Faws_spring_cloud_sandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinKindall%2Faws_spring_cloud_sandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinKindall%2Faws_spring_cloud_sandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinKindall","download_url":"https://codeload.github.com/martinKindall/aws_spring_cloud_sandbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243858931,"owners_count":20359259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","codebuild","java11","micrometer","parameter-store","spring-boot","spring-cloud"],"created_at":"2025-03-16T10:35:16.181Z","updated_at":"2025-12-31T00:19:58.055Z","avatar_url":"https://github.com/martinKindall.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS Spring Cloud\r\n\r\nJust testing out some features of the https://awspring.io/\r\n\r\n- Parameter Store\r\n\r\nAnd also trying [micrometer](https://micrometer.io/) for pushing metrics into Cloudwatch. \r\n\r\n## How to unpack the JAR for containerization\r\n\r\nFirst, build the project and generate the fat JAR in build/libs (just run gradle).\r\n\r\nThen execute:\r\n````bash\r\nmkdir build/dependency\r\ncd build/dependency\r\njar -xf ../libs/*.jar\r\n````\r\n\r\nThis will separate the fat JAR into BOOT-INF and META-INF.\r\nIn order to build the docker image:\r\n\r\n````bash\r\ndocker build -t \u003cimage_repo/image_name\u003e .\r\n````\r\n\r\nThe previous steps can be done automatically just executing\r\n````bash\r\nmkdir build/dependency\r\nsh build_image.sh\r\n````\r\n\r\nBeware! This assumes you have an ECR repository with a public image named __public.ecr.aws/f5n7q8r5/aws-spring-param-store__. \r\nFeel free to push the image to another repo like Docker Hub and to name it however you want.\r\n\r\n## Testing the image in a EC2 instance\r\n\r\nA plain EC2 instance with Amazon Linux 2 and docker installed is enough to test this. \r\n\r\n- Approach A (Recommended)\r\n  - Create an AMI out of Amazon Linux 2 with docker\r\n  - Launch an EC2 instance from this custom AMI\r\n  - Assign appropiate IAM Role for SSM Param store, Cloudwatch put-metric/put-logs/... and eventually DynamoDB read/write.\r\n  - Use aws/user_data.txt as the boot script when launching an EC2 instance\r\n- Approach B\r\n  - Launch an EC2 instance from default Amazon Linux 2\r\n  - Assign appropiate IAM Role (permissions above)\r\n  - Connect to it via ssh or AWS Console\r\n  - Install docker manually\r\n  - Execute 1 by 1 each command at aws/user_data.txt\r\n\r\nTo install docker manually [in the EC2](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html).\r\n\r\n### Instance Profile Authentication\r\n\r\nAs we are not providing the credentials neither in the environment nor as java system properties, the [AWS Credentials Provider Chain](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html) is going to keep\r\nlooking for credentials in other levels. In this example we are using the Instance profile credentials, which under my perspective\r\nare the safest ones.\r\n\r\n__Do not forget__ to assign the appropiate IAM role to the EC2 for reading from the Parameter Store and for pushing metrics into CloudWatch.\r\nFor this basic example the __AmazonSSMReadOnlyAccess__ plus the __CloudWatchAgentServerPolicy__ roles are going to be enough, although you will want\r\n to apply in real life apps the _least privilege permissions_ principle, in case the former policies are too permisive.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinkindall%2Faws_spring_cloud_sandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinkindall%2Faws_spring_cloud_sandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinkindall%2Faws_spring_cloud_sandbox/lists"}