Check the below image as I already set the Environment Variable with ACCESS and SECRET Key into CodeBuild AWS.
And I am trying to get those data into JAVA Project with the below code but unable to get value and get null output.
String access_key = System.getenv("AWS_ACCESS_KEY_ID");
String secret_key = System.getenv("AWS_SECRET_ACCESS_KEY");
System.err.println("access_key " + access_key);
System.err.println("secret_key " + secret_key);
Also tried with the below way but was unable to get the value of it.
System.err.println("Access key: "+StringParameter.valueFromLookup(this,"AWS_ACCESS_KEY_ID");
Also did the below way but did not get any success.
System.err.println("Access : "+EnvironmentVariableCredentialsProvider.create().resolveCredentials().accessKeyId());
Thanks in advance.