λλ°μ΄μ€λ₯Ό λ±λ‘νκΈ° μ μ ν΄μΌν μΌμ΄ μλ€.
- μΈμ¦μλ₯Ό μμ±ν΄μ ν΄λΉ λλ°μ΄μ€μ λ±λ‘
- ν΄λΉ μΈμ¦μμ μ μ± μ°κ²°
μ΄ κ³Όμ μ λλ΄κ³ λλ°μ΄μ€λ₯Ό λ±λ‘νκ³ μ νλ€.
μΈμ¦μλ μ μ± μ΄ λλ°
μΈμ¦μμ μ μ± μ κ΄λ ¨ν΄μ μ΄μ κΈμ κΈ°λ‘νλ€.
μ¬μ€ μ΄ λμ λν΄ κΉκ² μμ§λ λͺ»νμ§λ§.. κ°λ¨ν μμ½νμλ©΄ λ€μκ³Ό κ°λ€.
πΆ μΈμ¦μ
- λλ°μ΄μ€λ₯Ό μΈμ¦νκ³ AWS IoT Coreμ μμ νκ² ν΅μ ν μ μλλ‘ μ€μ (λλ°μ΄μ€ μ μ νμΈ)
- μλ§μ λλ°μ΄μ€κ° μΈν°λ·μ μ°κ²°λλ―λ‘ μΈμ¦μλ₯Ό ν΅ν΄ λλ°μ΄μ€ μΈμ¦νκ³ , ν΅μ μμ νκ² λ³΄νΈ
πΆ μ μ±
- μΈμ¦μλ₯Ό κ°μ§ λλ°μ΄μ€κ° μ΄λ€ μμ μ μνν μ μλμ§μ λν κΆν μ μ
- MQTT λ©μμ§ κ²μ λ° κ΅¬λ , HTTP μμ² λ± λλ°μ΄μ€κ° νμ©λ μμ μ μννλλ‘ μ ν
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:Publish",
"Resource": "arn:aws:iot:us-east-1:123456789012:topic/my/topic"
}
]
}
π νΉμ λλ°μ΄μ€κ° MQTT ν ν½μ λ©μμ§λ₯Ό κ²μν μ μλλ‘ νμ©νλ μ μ± μ μμ
IotAsyncClient & IotDataPlaneAsyncClient
π IoT λλ°μ΄μ€ 리μμ€ κ΄λ¦¬ λ° λ³΄μ μ μ± μ€μ
- createThing
- updateThing
- deleteThing λ±
π λλ°μ΄μ€ μν κ΄λ¦¬ λ° λ©μμ§ μ μ‘
- publish (λ©μμ§ μ μ‘)
- getThingShadow
- updateThingShadow λ±
β³οΈ AWSIotClientConfig
@Configuration
public class AWSIotClientConfiguration {
private final IotDataPlaneAsyncClient iotDataPlaneAsyncClient;
private final IotAsyncClient iotAsyncClient;
AWSIotClientConfiguration(@Value("${aws.accessKeyId}") String accessKeyId,
@Value("${aws.secretAccessKey}") String secretAccessKey,
@Value("${aws.region}") String region) throws IOException {
// μ½λ μλ΅
// region, credential, endpoint λ± μ€μ νμ
this.iotAsyncClient = IotAsyncClient.builder()
.region(Region.of(region))
.credentialsProvider(credentialsProvider)
.build();
this.iotDataPlaneAsyncClient = IotDataPlaneAsyncClient.builder()
.region(Region.of(region))
.endpointOverride(URI.create("https://" + endpoint))
.credentialsProvider(credentialsProvider)
.build();
}
// λΉ λ±λ‘
@Bean
public IotAsyncClient iotAsyncClient(){
return this.iotAsyncClient;
}
@Bean
public IotDataPlaneAsyncClient iotDataPlaneAsyncClient() {
return this.iotDataPlaneAsyncClient;
}
@PreDestroy
public void preDestroy() {
iotDataPlaneAsyncClient.close();
iotAsyncClient.close();
}
}
β³οΈ AWSDeviceManager
@Component
@Validated
public class AWSDeviceManager implements CloudDeviceManager {
private final IotAsyncClient iotAsyncClient;
// μμ‘΄μ± μ£Όμ
AmazonDeviceManager(IotAsyncClient iotAsyncClient) {
this.iotAsyncClient = iotAsyncClient;
}
// λλ°μ΄μ€ λ° μ μ±
κ΄λ ¨ service μ½λ
}
μΈμ¦μ μμ±, λ±λ‘, μμ
IotAsyncClientλ₯Ό νμ©ν΄ μΈμ¦μλ₯Ό μμ±νκ³ λ±λ‘νλ κ³Όμ μ μ΄ν΄λ³΄μ
β³οΈ μΈμ¦μ μμ±
π μμ±νλλ° νμ©λλ λ©μλκ° μ¬λ¬ κ° μλ€.. μ°¨μ΄λ₯Ό μμλ³΄κ³ μ μ ν κ²μΌλ‘ μ ννλ€.
πΆ createKeysAndCertificate π μ ν
create-keys-and-certificate — AWS CLI 2.22.3 Command Reference
Description Creates a 2048-bit RSA key pair and issues an X.509 certificate using the issued public key. You can also call CreateKeysAndCertificate over MQTT from a device, for more information, see Provisioning MQTT API . Note This is the only time IoT is
awscli.amazonaws.com
"2048-bit RSA key pair(κ³΅κ° ν€μ λΉκ³΅κ° ν€)λ₯Ό μμ±νκ³ λ°νλ κ³΅κ° ν€λ₯Ό ν΅ν΄ X.509 μΈμ¦μλ₯Ό μμ±νλ€"
π· Request
POST /keys-and-certificate?setAsActive=setAsActive HTTP/1.1β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"certificateArn": "string",
"certificateId": "string",
"certificatePem": "string",
"keyPair": {
"PrivateKey": "string",
"PublicKey": "string"
}
}β
πΉν€μ μ¬μ© λͺ©μ
π TLS(Transport Layer Security)λ₯Ό ν΅ν΄ μνΈνλκ³ , λλ°μ΄μ€λ λΉκ³΅κ° ν€λ₯Ό μ¬μ©ν΄ AWS IoT Coreμ μμ μ μ μμ μ¦λͺ
νλ€. AWS IoT Coreλ μΈμ¦μμ ν¬ν¨λ κ³΅κ° ν€λ₯Ό μ¬μ©ν΄ λλ°μ΄μ€λ₯Ό κ²μ¦νλ€.
λν, λλ°μ΄μ€λ AWS IoT Coreμμ μ°κ²°μ ν΅ν΄ MQTT λ©μμ§λ₯Ό μ£Όκ³ λ°λλ°, λ©μμ§κ° TLS μνΈνλ‘ λ³΄νΈλλ―λ‘ ν€λ λ©μμ§ κΈ°λ°μ±κ³Ό 무결μ±μ 보μ₯νλ€.
πΆ createCertificateFromCsr
create-certificate-from-csr — AWS CLI 2.22.3 Command Reference
Note To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information. Unless otherwise stated, all examples have unix-like quotation rules. These examples will
awscli.amazonaws.com
λ νΌλ°μ€λ₯Ό μ°Έκ³ ν΄λ³΄λ©΄ "νΉμ ν certificate signing requestλ₯Ό μ¬μ©ν΄ X.509 μΈμ¦μλ₯Ό μμ±νλ κ²"μ΄λΌ λμμλ€.
μ£Όλ‘ λλ°μ΄μ€λ μΈλΆ μμ€ν μμ μμ±ν κ³΅κ° ν€μ κΈ°λ°ν μΈμ¦μλ₯Ό λ°κΈν λ μ¬μ©λλ€κ³ νλ€.
π· Request
POST /certificates?setAsActive=setAsActive HTTP/1.1
Content-type: application/json
{
"certificateSigningRequest": "string"
}β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"certificateArn": "string",
"certificateId": "string",
"certificatePem": "string"
}
β outputμ 보면 μνλ κ²μ μ»μ μ μκΈ΄ νμ§λ§ μμ²ν λ CSRμ΄ νμνλ€.
πΆ createCertificateProvider
create-certificate-provider — AWS CLI 2.22.3 Command Reference
awscli.amazonaws.com
"CA λλ certificate providerλ₯Ό μμ±νκ³ κ΅¬μ±νλ λ° μ¬μ©λλ€"
π· Request
POST /certificate-providers/certificateProviderName HTTP/1.1
Content-type: application/json
{
"accountDefaultForOperations": [ "string" ],
"clientToken": "string",
"lambdaFunctionArn": "string",
"tags": [
{
"Key": "string",
"Value": "string"
}
]
}β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"certificateProviderArn": "string",
"certificateProviderName": "string"
}β
β CAλ₯Ό AWS IoT Coreμ λ±λ‘νλ λ± λ€μ 볡μ‘ν κ³Όμ νμ
β³οΈ μΈμ¦μ λ±λ‘
AWS IoTμ μ΄λ―Έ μμ±λ μΈμ¦μλ₯Ό λ±λ‘νλ APIμ΄λ€.
λλ°μ΄μ€μμ μ체μ μΌλ‘ μΈμ¦μλ₯Ό μμ±ν κ²½μ°λ μΈλΆ μΈμ¦κΈ°κ΄(CA)μ ν΅ν΄ λ°κΈλ°μ μΈμ¦μλ₯Ό μ¬μ©νλ κ²½μ°μ νμ©ν μ μλ€.
νμ¬λ AWS IoTμμ μ§μ μΈμ¦μλ₯Ό μμ±νλ κ²½μ°μ΄λ―λ‘ μΆνμ νμνκ² λλ€λ©΄ μΈ μ μμ κ² κ°λ€.
πΆ registerCertificate
https://docs.aws.amazon.com/iot/latest/apireference/API_RegisterCertificate.html
RegisterCertificate - AWS IoT
RegisterCertificate Registers a device certificate with AWS IoT in the same certificate mode as the signing CA. If you have more than one CA certificate that has the same subject field, you must specify the CA certificate that was used to sign the device c
docs.aws.amazon.com
π· Request
POST /certificate/register?setAsActive=setAsActive HTTP/1.1
Content-type: application/json
{
"caCertificatePem": "string",
"certificatePem": "string",
"status": "string"
}β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"certificateArn": "string",
"certificateId": "string"
}β
πΆ registerCACertificate
https://docs.aws.amazon.com/iot/latest/apireference/API_RegisterCACertificate.html
RegisterCACertificate - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
π· Request
POST /cacertificate?allowAutoRegistration=allowAutoRegistration&setAsActive=setAsActive HTTP/1.1
Content-type: application/json
{
"caCertificate": "string",
"certificateMode": "string",
"registrationConfig": {
"roleArn": "string",
"templateBody": "string",
"templateName": "string"
},
"tags": [
{
"Key": "string",
"Value": "string"
}
],
"verificationCertificate": "string"
}β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"certificateArn": "string",
"certificateId": "string"
}
πΆ registerCertificateWithoutCA
https://docs.aws.amazon.com/iot/latest/apireference/API_RegisterCertificateWithoutCA.html
RegisterCertificateWithoutCA - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
π· Request
POST /certificate/register-no-ca HTTP/1.1
Content-type: application/json
{
"certificatePem": "string",
"status": "string"
}β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"certificateArn": "string",
"certificateId": "string"
}
β³οΈ μΈμ¦μ μμ
πΆ deleteCertificate π μ ν
https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteCertificate.html
DeleteCertificate - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
λ§μ½ μ μ± λλ IoT thingμ μΈμ¦μκ° μ°κ²°λμ΄μκ±°λ νμ±ν(ACTIVE)λμ΄ μλ€λ©΄ μΈμ¦μλ μμ λ μ μλ€.
μΈμ¦μλ₯Ό μμ νκΈ° μν΄μλ DetachPolicyλ₯Ό λ¨Όμ μνν ν UpdateCertificateμ ν΅ν΄ λΉνμ±ν(INACTIVE) μνλ‘ μ€μ ν΄μΌνλ€.
πΆ deleteCACertificate
https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteCACertificate.html
DeleteCACertificate - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
λ±λ‘λ CAμΈμ¦μλ₯Ό μμ νλ€.
πΆ deleteCertificateProvider
https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteCertificateProvider.html
DeleteCertificateProvider - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
λ§μ½ certificate provider resourceλ₯Ό μμ νλ€λ©΄ CreateCertificateFromCsrμ΄ μνλ κ²μ΄κ³ , AWS IoTλ CSRμ ν΅ν΄ μλͺ ν μΈμ¦μλ₯Ό μμ±νλ€.
μ μ± μ°κ²°, μμ
β³οΈ μ μ± μ°κ²°
πΆ attachPolicy
https://docs.aws.amazon.com/iot/latest/apireference/API_AttachPolicy.html
AttachPolicy - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
νΉμ μΈμ¦μ λλ κΈ°ν μ격 μ¦λͺ μ μ μ± μ μ°κ²°νλ€.
π· Request
PUT /target-policies/policyName HTTP/1.1
Content-type: application/json
{
"target": "string"
}β
π· Response
π Empty HTTP body
HTTP/1.1 200
β³οΈ μ μ± μμ
πΆ detachPolicy
https://docs.aws.amazon.com/iot/latest/apireference/API_DetachPolicy.html
DetachPolicy - AWS IoT
Because of the distributed nature of AWS, it can take up to five minutes after a policy is detached before it's ready to be deleted.
docs.aws.amazon.com
π· Request
POST /target-policies/policyName HTTP/1.1
Content-type: application/json
{
"target": "string"
}β
π· Response
π Empty HTTP body
HTTP/1.1 200
μ¬λ¬Ό(thing) λ±λ‘, μμ
β³οΈ μ¬λ¬Ό μμ±
πΆ createThing
https://docs.aws.amazon.com/iot/latest/apireference/API_CreateThing.html
CreateThing - AWS IoT
CreateThing Creates a thing record in the registry. If this call is made multiple times using the same thing name and configuration, the call will succeed. If this call is made with the same thing name but different configuration a ResourceAlreadyExistsExc
docs.aws.amazon.com
π· Request
POST /things/thingName HTTP/1.1
Content-type: application/json
{
"attributePayload": {
"attributes": {
"string" : "string"
},
"merge": boolean
},
"billingGroupName": "string",
"thingTypeName": "string"
}β
π· Response
HTTP/1.1 200
Content-type: application/json
{
"thingArn": "string",
"thingId": "string",
"thingName": "string"
}β
β³οΈ μ¬λ¬Ό μμ
πΆ deleteThing
https://docs.aws.amazon.com/iot/latest/apireference/API_DeleteThing.html
DeleteThing - AWS IoT
Thanks for letting us know this page needs work. We're sorry we let you down. If you've got a moment, please tell us how we can make the documentation better.
docs.aws.amazon.com
π· Request
DELETE /things/thingName?expectedVersion=expectedVersion HTTP/1.1β
π· Response
π Empty HTTP body
HTTP/1.1 200β
μ°Έκ³ μλ£
https://docs.aws.amazon.com/iot/latest/apireference/API_Operations_AWS_IoT.html
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/iot/package-summary.html
'AWS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[AWS] AWS IoT λλ°μ΄μ€ μμ μ μ°¨ μ½λλ‘ μμ보기 (0) | 2024.12.13 |
---|---|
[AWS] AWS IoT λλ°μ΄μ€ λ±λ‘ μ μ°¨ μ½λλ‘ μμ보기 (0) | 2024.11.29 |
[AWS] AWS IoT Core μ΄κ²μ κ² (1) | 2024.11.21 |
[AWS] AWS Cognitoμ OAuth (3) | 2024.10.28 |
[AWS] AWS CloudFormation (0) | 2024.10.15 |