I've got a doubt about the AWS Code license, specifically, I've been using fragments of code from the AWS repository for the Javascript SDK v3 interacting with Cognito. In some fragments of code, for example here: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cognito-identity-provider/classes/getusercommand.html

The license for the Code is

/** Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0 */

This being said, if I want to use this fragment inside my code (more extensive), do I have to keep this code license? What if I want to license all code (the fragment of AWS repository and my own code more extensive) with MIT license, can I do it ? Do I instead have to keep the Apache license in the fragment while I put my code under the MIT license?.

Also, because I've to include source modifications as Apache License says, I should include them, the Apache 2.0 license, and a statement with any major change. The changes that I am going to introduce are not very significant, anyway, I prefer (if it's possible) to include these changes, but in what way can I do it? For, for example in the same file which includes the Apache license from AWS and the modified code ?, between comments lines, or how can I do it? Finally, if I decide to distribute the code with an MIT license, again, in what way, is it enough including the license file called "LICENSE" with my copyright? and the text of the license? for example:

MIT License

Copyright (c) 2023 dcorralf

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation, etc ... 

To sum up, the final project will contain the Apache 2.0 License from AWS with a statement in case we add some changes, and this is for each file that uses code from AWS, and finally in the resulting code push to my Github repository, and add the MIT license file ? is that so?

  • I think you need to distinguish between: the AWK-SDK itself (which is Apache-2.0 licensed), which you write by using the SDK and by consulting the documentation (which includes code examples). In general, code that you write is your own, unless you've created a derivative work. Personally I find it hard to believe that consulting the documentation would create a derivative work. Sure, you may write specific lines of code that looks similar in some places, but those similarities are probably due to the fact that the API requires certain parameters in a certain order. This is inevitable.
    – Brandin
    Jun 27 at 12:57
  • See also: opensource.stackexchange.com/questions/9179/… I think this similar question (the one you are likely asking about) has come up before.
    – Brandin
    Jun 27 at 12:59
  • Maybe someone who knows about this case can comment, but when you build your project using the AWS-SDK, does the resulting project that you redistribute actually contain the SDK as a part of your program? I think it depends on the SDK, whether that's the case.
    – Brandin
    Jun 27 at 13:05

1 Answer 1


This answer will give you many cases, sometimes complicated, but you will notice many options.

First: you need to check license compatibility. The MIT license with Apache 2.0 is compatible with the MIT->Apache site. That means you can take MIT-licensed code, change it, and release it under Apache 2.0, but not vice versa.

If you use code snippets in multiple places, I recommend changing your license from MIT to Apache. That will be the easiest.

Theoretically you could make a comment on the lines with Apache code THIS CODE IS NOT UNDER A MIT LICENSE, IT IS ON APACHE 2.0 (C) *here goes entire Amazon (C) line* or something similar, but that makes it harder.

If you use code in one file, maybe in several, you can mark the project as MIT, but those files as Apache 2.0. It's also bothersome.

So, I recommend using the Apache license, or if you care about the MIT license, add a mention that any of your code that is not derived from the Apache licensed code is available under the MIT license (remember to include the MIT license file then), but it is It does not make sense.

A better option might be to add an MIT (full) license to files that are only yours and then add the ID SPDX: Apache-2.0 OR MIT as well. Then, possibly, other people will be able to choose a license.

Despite these options, I still believe: change the license to Apache.

The second thing is the summary of the changes. In fact, you can add a note about each edit and de jure I guess it's correct, but Git does it for you :) You can also make a CHANGELOG

This is not legal advice

  • Wow, your reply it's awesome, I thought anybody want to reply my question, and I've learned a lot with your explanation. Thanks a lot for your great support and Congratulations for your knowledge about these topics.
    – David
    Jun 28 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.